nikivdev/code · error
FLOW_CODEX_MAPLE_LOCAL_ENDPOINT and FLOW_CODEX_MAPLE_LOCAL_I
Error message
FLOW_CODEX_MAPLE_LOCAL_ENDPOINT and FLOW_CODEX_MAPLE_LOCAL_INGEST_KEY must both be set
What it means
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.
Source
Thrown at src/codex_telemetry.rs:247
fn parse_maple_exporter_config_from_env() -> Result<Option<MapleExporterConfig>> {
let allow_store_fallback = !shell_has_explicit_maple_target_env();
let mut personal_env = if allow_store_fallback {
None
} else {
Some(None)
};
let mut targets = Vec::new();
match (
env_non_empty_with_store("FLOW_CODEX_MAPLE_LOCAL_ENDPOINT", &mut personal_env),
env_non_empty_with_store("FLOW_CODEX_MAPLE_LOCAL_INGEST_KEY", &mut personal_env),
) {
(Some(endpoint), Some(key)) => targets.push(MapleIngestTarget {
traces_endpoint: endpoint,
ingest_key: key,
}),
(None, None) => {}
_ => anyhow::bail!(
"FLOW_CODEX_MAPLE_LOCAL_ENDPOINT and FLOW_CODEX_MAPLE_LOCAL_INGEST_KEY must both be set"
),
}
match (
env_non_empty_with_store("FLOW_CODEX_MAPLE_HOSTED_ENDPOINT", &mut personal_env),
env_non_empty_with_store("FLOW_CODEX_MAPLE_HOSTED_INGEST_KEY", &mut personal_env),
) {
(Some(endpoint), Some(key)) => targets.push(MapleIngestTarget {
traces_endpoint: endpoint,
ingest_key: key,
}),
(None, None) => {}
_ => anyhow::bail!(
"FLOW_CODEX_MAPLE_HOSTED_ENDPOINT and FLOW_CODEX_MAPLE_HOSTED_INGEST_KEY must both be set"
),
}
View on GitHub (pinned to a747e741ae)
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
Example fix
// before FLOW_CODEX_MAPLE_LOCAL_ENDPOINT=http://localhost:7281 # after (both set) FLOW_CODEX_MAPLE_LOCAL_ENDPOINT=http://localhost:7281 FLOW_CODEX_MAPLE_LOCAL_INGEST_KEY=sk-local-123
Defensive patterns
Strategy: validation
Validate before calling
fn local_maple_config_ok() -> bool {
let ep = std::env::var("FLOW_CODEX_MAPLE_LOCAL_ENDPOINT").ok().filter(|v| !v.is_empty());
let key = std::env::var("FLOW_CODEX_MAPLE_LOCAL_INGEST_KEY").ok().filter(|v| !v.is_empty());
ep.is_some() == key.is_some()
}
assert!(local_maple_config_ok(), "set both FLOW_CODEX_MAPLE_LOCAL_* vars or neither"); Type guard
fn paired(a: Option<String>, b: Option<String>) -> Option<(String, String)> {
match (a.filter(|v| !v.is_empty()), b.filter(|v| !v.is_empty())) {
(Some(x), Some(y)) => Some((x, y)),
_ => None,
}
} Try / catch
match telemetry::status() {
Err(e) if e.to_string().contains("LOCAL_ENDPOINT") => {
eprintln!("{} — fix FLOW_CODEX_MAPLE_LOCAL_* pair in env", e);
Err(e)
}
other => other,
} Prevention
- 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
When it happens
Trigger: 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).
Common situations: 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.
Understand the failure class
Background: "environment variable is not set" and "Missing keys in environment" errors: what missing required env var messages mean and how to fix them — this error's family across 28 libraries.
Related errors
- FLOW_CODEX_MAPLE_HOSTED_ENDPOINT and FLOW_CODEX_MAPLE_HOSTED
- FLOW_CODEX_MAPLE_TRACES_ENDPOINTS count ({}) does not match
- No [cloudflare] or [storage] env keys configured in flow.tom
- No profile selected.
- expected [{}] to be a table in global flow config
AI-assisted analysis of nikivdev/code@a747e741ae (2026-09-01).
Data as JSON: /api/errors/8b6b552fe11ea16a.
Report an issue: GitHub.