# How to Disable Telemetry in no-mistakes: Environment Variable Configuration

> Easily disable telemetry in no-mistakes by setting the NO_MISTAKES_TELEMETRY environment variable to off false or 0 Learn how to control data collection in your kunchenguid/no-mistakes environment

- Repository: [Kun Chen/no-mistakes](https://github.com/kunchenguid/no-mistakes)
- Tags: how-to-guide
- Published: 2026-07-14

---

**Set the environment variable `NO_MISTAKES_TELEMETRY` to `off`, `false`, or `0` before running any command to completely disable the telemetry subsystem.**

The `no-mistakes` CLI includes a lightweight telemetry subsystem that reports anonymized usage metrics to help improve the project. If you need to disable telemetry in `no-mistakes` for privacy or compliance reasons, the application provides a straightforward opt-out mechanism controlled entirely through environment variables according to the source code in [`internal/telemetry/telemetry.go`](https://github.com/kunchenguid/no-mistakes/blob/main/internal/telemetry/telemetry.go).

## How Telemetry Works in no-mistakes

The telemetry implementation resides in [`internal/telemetry/telemetry.go`](https://github.com/kunchenguid/no-mistakes/blob/main/internal/telemetry/telemetry.go) and operates through a guard function pattern. Before transmitting any data, the system invokes `telemetryDisabled()` to check the runtime environment. This function evaluates the `NO_MISTAKES_TELEMETRY` variable and returns `true` when telemetry should be suppressed, causing the application to bypass all calls to `telemetry.Track` and `telemetry.Pageview` events.

## Disabling Telemetry via Environment Variable

To disable telemetry for a single session, export the `NO_MISTAKES_TELEMETRY` variable in your shell before invoking the CLI. The application reads this variable at startup and skips telemetry initialization entirely when a disable value is detected.

```bash

# Disable telemetry for the current shell session

export NO_MISTAKES_TELEMETRY=off
no-mistakes status

```

### Recognized Disable Values

The `telemetryDisabled()` function normalizes the environment variable by trimming whitespace and converting to lowercase. According to the source implementation, the following values disable telemetry:

- `off`
- `false`
- `0`

Any other value, including an unset variable, results in telemetry remaining enabled.

## Persistent Configuration with .env Files

For permanent opt-out without setting shell variables for every command, `no-mistakes` supports loading environment variables from a `.env` file in the repository root. The CLI automatically loads this file, applying your telemetry preferences across all invocations.

```bash

# Create persistent opt-out configuration

echo "NO_MISTAKES_TELEMETRY=off" >> .env

```

The build verification tests in [`makefile_test.go`](https://github.com/kunchenguid/no-mistakes/blob/main/makefile_test.go) confirm that the application correctly reads `.env` files to override default telemetry configuration, demonstrating this mechanism works for both host settings and opt-out flags.

## Technical Implementation Details

The opt-out logic is centralized in the `telemetryDisabled()` function within [`internal/telemetry/telemetry.go`](https://github.com/kunchenguid/no-mistakes/blob/main/internal/telemetry/telemetry.go). This function acts as a circuit breaker: before any HTTP request reaches the analytics endpoint, the CLI entry point in [`internal/cli/telemetry.go`](https://github.com/kunchenguid/no-mistakes/blob/main/internal/cli/telemetry.go) queries this guard. When `telemetryDisabled()` returns `true`, the application exits early from telemetry code paths, ensuring zero network activity to tracking servers.

The telemetry client initialization and all reporting methods respect this single source of truth, making the environment variable check the authoritative control for the entire subsystem.

## Summary

- Set `NO_MISTAKES_TELEMETRY` to `off`, `false`, or `0` to disable telemetry in any shell session
- The `telemetryDisabled()` function in [`internal/telemetry/telemetry.go`](https://github.com/kunchenguid/no-mistakes/blob/main/internal/telemetry/telemetry.go) controls all opt-out logic for the application
- Place the variable in a `.env` file for persistent configuration without manual exports
- All telemetry network calls, including `telemetry.Track` and `telemetry.Pageview`, are bypassed when the guard function detects a disabled state

## Frequently Asked Questions

### What values disable telemetry in no-mistakes?

The values `off`, `false`, and `0` (case-insensitive) disable telemetry when stored in the `NO_MISTAKES_TELEMETRY` environment variable. The `telemetryDisabled()` function trims whitespace and converts input to lowercase before comparing against these three sentinel values.

### Does no-mistakes send telemetry data before checking the environment variable?

No. According to the source code in [`internal/telemetry/telemetry.go`](https://github.com/kunchenguid/no-mistakes/blob/main/internal/telemetry/telemetry.go), the `telemetryDisabled()` guard executes before any calls to `telemetry.Track` or `telemetry.Pageview`. If the check returns `true`, the application bypasses HTTP requests to the analytics endpoint entirely, ensuring no data transmission occurs.

### Can I disable telemetry permanently without exporting variables every time?

Yes. Create a `.env` file in your project root containing `NO_MISTAKES_TELEMETRY=off`. The CLI loads this file automatically at startup, applying the opt-out setting persistently across all commands without requiring manual shell configuration.

### Which source files control the telemetry disable logic?

The disable logic resides in the `telemetryDisabled()` function within [`internal/telemetry/telemetry.go`](https://github.com/kunchenguid/no-mistakes/blob/main/internal/telemetry/telemetry.go). The CLI integration in [`internal/cli/telemetry.go`](https://github.com/kunchenguid/no-mistakes/blob/main/internal/cli/telemetry.go) consumes this function to determine whether to initialize the telemetry client or skip reporting. The [`makefile_test.go`](https://github.com/kunchenguid/no-mistakes/blob/main/makefile_test.go) file contains tests verifying that environment variables properly override telemetry configuration.