Hmbown/CodeWhale · info · anyhow::Error

telemetry is disabled

Error message

telemetry is disabled

What it means

read_or_create_install_id mints or loads the anonymous install identifier stored in $CODEWHALE_HOME/telemetry/install_id.json. It refuses to run when a tombstone is present, because a tombstone means the user wiped/opted out of telemetry — minting or reading an id then would violate that choice, so it bails with 'telemetry is disabled'.

Solutions

  1. Check telemetry::buffer::tombstone_present(root) before calling and skip install-id creation when telemetry is off.
  2. Call buffer::arm() (or re-enable telemetry with user consent) to clear the tombstone, then retry.
  3. Treat the error as expected opt-out: handle it in the caller and continue without telemetry.
  4. Remove a stale tombstone only if the user explicitly re-enabled telemetry.

Example fix

// before: unconditional id creation
let id = read_or_create_install_id(root)?;
// after: guard on the tombstone
let id = if buffer::tombstone_present(root) {
    None
} else {
    Some(read_or_create_install_id(root)?)
};
Defensive patterns

Strategy: validation

Validate before calling

fn can_read_install_id(root: &Path) -> bool {
    !telemetry::buffer::tombstone_present(root)
}

Try / catch

match read_or_create_install_id(root) {
    Err(e) if e.to_string().contains("telemetry is disabled") => {
        InstallId::absent() // continue without telemetry
    }
    r => r?,
}

Prevention

When it happens

Trigger: Calling read_or_create_install_id(root) while buffer::tombstone_present(root) is true, i.e. after wipe() created the tombstone in the telemetry directory.

Common situations: User disabled telemetry earlier; app code path still unconditionally builds the install id (e.g. envelope construction); stale tombstone left from a previous opt-out; running a command that touches telemetry after the user wiped it.

Related errors


AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22). Data as JSON: /api/errors/144097dc68bba781. Report an issue: GitHub.

Appendix: source

Thrown at crates/telemetry/src/envelope.rs:64

    /// When a flush was last *attempted*, RFC3339 UTC. Attempt, not success, so
    /// a permanently offline machine tries at most once per interval.
    #[serde(default)]
    pub last_flush: Option<String>,
}

/// Read the install id, minting a fresh one if it is missing, unreadable,
/// **not a UUID**, or older than [`ROTATION_DAYS`].
///
/// The UUID check is not a formatting nicety. `install_id` is the one
/// envelope field read verbatim off disk into a batch, so without it the file
/// is a free-form string slot on the wire for anything that can write
/// `$CODEWHALE_HOME/telemetry/install_id.json`. Minting a fresh random id is
/// always the safe direction — the cost is one rotation, and the docs already
/// say no count derived from `install_id` is a user count.
pub fn read_or_create_install_id(root: &Path) -> Result<InstallId> {
    buffer::try_with_lock(root, || {
        if buffer::tombstone_present(root) {
            anyhow::bail!("telemetry is disabled");
        }
        let path = buffer::install_id_path(root);
        let existing = std::fs::read_to_string(&path)
            .ok()
            .and_then(|body| serde_json::from_str::<InstallId>(&body).ok())
            .filter(|record| uuid::Uuid::parse_str(record.install_id.trim()).is_ok())
            .filter(|record| !is_expired(&record.rotated_at));
        if let Some(record) = existing {
            return Ok(record);
        }
        let record = InstallId {
            schema_version: 1,
            install_id: uuid::Uuid::new_v4().to_string(),
            rotated_at: now_rfc3339(),
        };
        codewhale_config::persistence::atomic_write_json(&path, &record)
            .with_context(|| format!("failed to write {}", path.display()))?;
        Ok(record)

View on GitHub (pinned to 73e0f67d83)