{"record":{"id":"c7a6cae746ad0f18","repo":"BoundaryML/baml","slug":"this-build-has-no-posthog-key-configured","errorCode":null,"errorMessage":"This build has no PostHog key configured.","messagePattern":"This build has no PostHog key configured\\.","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"baml_language/crates/baml_cli/src/feedback_command.rs","lineNumber":911,"sourceCode":"        return;\n    };\n    let identified_id = creds.user_id.as_deref().unwrap_or(email);\n    let body = json!({\n        \"api_key\": crate::telemetry::posthog_api_key(),\n        \"event\": \"$identify\",\n        \"distinct_id\": identified_id,\n        \"properties\": {\n            \"$anon_distinct_id\": anon_id,\n            \"$set\": { \"email\": email },\n        },\n    });\n    let _ = post_event(&body);\n}\n\nfn post_event(body: &Value) -> Result<()> {\n    let api_key = body[\"api_key\"].as_str().unwrap_or(\"\");\n    if api_key.trim().is_empty() {\n        anyhow::bail!(\"This build has no PostHog key configured.\");\n    }\n    let resp = auth::http_client()\n        .post(format!(\"{}/capture/\", posthog_host().trim_end_matches('/')))\n        .json(body)\n        .send()\n        .context(\"Failed to reach PostHog\")?;\n    let status = resp.status();\n    if !status.is_success() {\n        anyhow::bail!(\"PostHog returned {status}\");\n    }\n    Ok(())\n}\n\n#[cfg(test)]\nmod tests {\n    use super::*;\n\n    fn send_args(","sourceCodeStart":893,"sourceCodeEnd":929,"githubUrl":"https://github.com/BoundaryML/baml/blob/bd85ce9dee1463ff04d27efd20531013a4ff46c1/baml_language/crates/baml_cli/src/feedback_command.rs#L893-L929","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Recognize this build ships without telemetry; feedback will not be uploaded via PostHog.","Build the CLI with the PostHog key configured (the release build's env var/secret) if you need event upload.","Submit feedback through the project's GitHub issues instead.","Ignore if intentional: callers discard this error by design (`let _ = post_event(&body)`)."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"if let Err(e) = post_event(&body) {\n  eprintln!(\"telemetry disabled: {e}\"); // non-fatal\n}","preventionTips":["Check whether your CLI build includes telemetry before relying on PostHog-backed feedback.","For source builds, provide the PostHog key env/secret at compile time.","Treat telemetry failures as non-fatal and offer alternative feedback channels (GitHub issues)."],"tags":["telemetry","posthog","missing-api-key"],"backgroundTag":"missing-api-key","analyzedSha":"bd85ce9dee1463ff04d27efd20531013a4ff46c1","analyzedAt":"2026-09-12T03:38:25.718Z","contentChangedAt":"2026-09-12T03:38:25.718Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}