{"record":{"id":"8b6b552fe11ea16a","repo":"nikivdev/code","slug":"flow-codex-maple-local-endpoint-and-flow-codex-map","errorCode":null,"errorMessage":"FLOW_CODEX_MAPLE_LOCAL_ENDPOINT and FLOW_CODEX_MAPLE_LOCAL_INGEST_KEY must both be set","messagePattern":"FLOW_CODEX_MAPLE_LOCAL_ENDPOINT and FLOW_CODEX_MAPLE_LOCAL_INGEST_KEY must both be set","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/codex_telemetry.rs","lineNumber":247,"sourceCode":"fn parse_maple_exporter_config_from_env() -> Result<Option<MapleExporterConfig>> {\n    let allow_store_fallback = !shell_has_explicit_maple_target_env();\n    let mut personal_env = if allow_store_fallback {\n        None\n    } else {\n        Some(None)\n    };\n    let mut targets = Vec::new();\n\n    match (\n        env_non_empty_with_store(\"FLOW_CODEX_MAPLE_LOCAL_ENDPOINT\", &mut personal_env),\n        env_non_empty_with_store(\"FLOW_CODEX_MAPLE_LOCAL_INGEST_KEY\", &mut personal_env),\n    ) {\n        (Some(endpoint), Some(key)) => targets.push(MapleIngestTarget {\n            traces_endpoint: endpoint,\n            ingest_key: key,\n        }),\n        (None, None) => {}\n        _ => anyhow::bail!(\n            \"FLOW_CODEX_MAPLE_LOCAL_ENDPOINT and FLOW_CODEX_MAPLE_LOCAL_INGEST_KEY must both be set\"\n        ),\n    }\n\n    match (\n        env_non_empty_with_store(\"FLOW_CODEX_MAPLE_HOSTED_ENDPOINT\", &mut personal_env),\n        env_non_empty_with_store(\"FLOW_CODEX_MAPLE_HOSTED_INGEST_KEY\", &mut personal_env),\n    ) {\n        (Some(endpoint), Some(key)) => targets.push(MapleIngestTarget {\n            traces_endpoint: endpoint,\n            ingest_key: key,\n        }),\n        (None, None) => {}\n        _ => anyhow::bail!(\n            \"FLOW_CODEX_MAPLE_HOSTED_ENDPOINT and FLOW_CODEX_MAPLE_HOSTED_INGEST_KEY must both be set\"\n        ),\n    }\n","sourceCodeStart":229,"sourceCodeEnd":265,"githubUrl":"https://github.com/nikivdev/code/blob/a747e741ae92c09071d0ae946ab48488adcff1ce/src/codex_telemetry.rs#L229-L265","documentation":"The Maple telemetry exporter accepts a local ingest target only as a complete pair: both `FLOW_CODEX_MAPLE_LOCAL_ENDPOINT` and `FLOW_CODEX_MAPLE_LOCAL_INGEST_KEY` must be present, or neither. Setting exactly one is treated as a configuration error. This parser runs on every `status`/`flush` call, so the error fires at runtime, not just at startup.","triggerScenarios":"Calling telemetry `status` or `flush` with exactly one of the two local env vars set to a non-empty value (the other unset or empty).","commonSituations":"Adding the endpoint var to a `.env`/CI secret store but forgetting the ingest key (or vice versa); rotating secrets and clearing one var; typos in one of the two variable names.","solutions":["Set both FLOW_CODEX_MAPLE_LOCAL_ENDPOINT and FLOW_CODEX_MAPLE_LOCAL_INGEST_KEY to non-empty values","Or unset both if you do not want local Maple ingestion","Check for empty-string values — empty counts as unset and triggers the same error"],"exampleFix":"// before\nFLOW_CODEX_MAPLE_LOCAL_ENDPOINT=http://localhost:7281\n# after (both set)\nFLOW_CODEX_MAPLE_LOCAL_ENDPOINT=http://localhost:7281\nFLOW_CODEX_MAPLE_LOCAL_INGEST_KEY=sk-local-123","handlingStrategy":"validation","validationCode":"fn local_maple_config_ok() -> bool {\n    let ep = std::env::var(\"FLOW_CODEX_MAPLE_LOCAL_ENDPOINT\").ok().filter(|v| !v.is_empty());\n    let key = std::env::var(\"FLOW_CODEX_MAPLE_LOCAL_INGEST_KEY\").ok().filter(|v| !v.is_empty());\n    ep.is_some() == key.is_some()\n}\nassert!(local_maple_config_ok(), \"set both FLOW_CODEX_MAPLE_LOCAL_* vars or neither\");","typeGuard":"fn paired(a: Option<String>, b: Option<String>) -> Option<(String, String)> {\n    match (a.filter(|v| !v.is_empty()), b.filter(|v| !v.is_empty())) {\n        (Some(x), Some(y)) => Some((x, y)),\n        _ => None,\n    }\n}","tryCatchPattern":"match telemetry::status() {\n    Err(e) if e.to_string().contains(\"LOCAL_ENDPOINT\") => {\n        eprintln!(\"{} — fix FLOW_CODEX_MAPLE_LOCAL_* pair in env\", e);\n        Err(e)\n    }\n    other => other,\n}","preventionTips":["Store paired env vars together in .env files, secret stores, and CI templates","Treat empty strings as unset when exporting these variables","Sanity-check both LOCAL_* variables in a startup/CI preflight step"],"tags":["telemetry","env","config","maple"],"backgroundTag":"missing-env-var","analyzedSha":"a747e741ae92c09071d0ae946ab48488adcff1ce","analyzedAt":"2026-09-01T22:43:55.719Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}