BoundaryML/baml · warning

This build has no PostHog key configured.

Error message

This build has no PostHog key configured.

What it means

The feedback/telemetry code sends events to PostHog, but this build of the BAML CLI was compiled without a PostHog API key baked in. `post_event` checks the `api_key` field of the event body and bails when it is empty. The event is silently dropped (callers use `let _ = post_event(...)`), so this indicates telemetry is disabled for the build.

Solutions

  1. Recognize this build ships without telemetry; feedback will not be uploaded via PostHog.
  2. Build the CLI with the PostHog key configured (the release build's env var/secret) if you need event upload.
  3. Submit feedback through the project's GitHub issues instead.
  4. Ignore if intentional: callers discard this error by design (`let _ = post_event(&body)`).
Defensive patterns

Strategy: fallback

Try / catch

if let Err(e) = post_event(&body) {
  eprintln!("telemetry disabled: {e}"); // non-fatal
}

Prevention

When it happens

Trigger: Calling `send_feedback` or `identify` in a CLI build where the compile-time PostHog key env/config was absent, so the event body's `api_key` is empty or missing.

Common situations: Running a locally built or open-source build of the CLI without the PostHog key set at compile time; corporate/offline builds with telemetry stripped; contributors building from source without the release secrets.

Understand the failure class

Background: "API key is required" / "API key not found" / "No API key was set": the missing-api-key error family across 16 libraries — this error's family across 16 libraries.

Related errors


AI-assisted analysis of BoundaryML/baml@bd85ce9dee (2026-09-12). Data as JSON: /api/errors/c7a6cae746ad0f18. Report an issue: GitHub.

Appendix: source

Thrown at baml_language/crates/baml_cli/src/feedback_command.rs:911

        return;
    };
    let identified_id = creds.user_id.as_deref().unwrap_or(email);
    let body = json!({
        "api_key": crate::telemetry::posthog_api_key(),
        "event": "$identify",
        "distinct_id": identified_id,
        "properties": {
            "$anon_distinct_id": anon_id,
            "$set": { "email": email },
        },
    });
    let _ = post_event(&body);
}

fn post_event(body: &Value) -> Result<()> {
    let api_key = body["api_key"].as_str().unwrap_or("");
    if api_key.trim().is_empty() {
        anyhow::bail!("This build has no PostHog key configured.");
    }
    let resp = auth::http_client()
        .post(format!("{}/capture/", posthog_host().trim_end_matches('/')))
        .json(body)
        .send()
        .context("Failed to reach PostHog")?;
    let status = resp.status();
    if !status.is_success() {
        anyhow::bail!("PostHog returned {status}");
    }
    Ok(())
}

#[cfg(test)]
mod tests {
    use super::*;

    fn send_args(

View on GitHub (pinned to bd85ce9dee)