nikivdev/code · error
FLOW_CODEX_MAPLE_TRACES_ENDPOINTS count ({}) does not match
Error message
FLOW_CODEX_MAPLE_TRACES_ENDPOINTS count ({}) does not match FLOW_CODEX_MAPLE_INGEST_KEYS count ({}) What it means
The exporter also supports multiple ingest targets via two comma-separated lists: `FLOW_CODEX_MAPLE_TRACES_ENDPOINTS` and `FLOW_CODEX_MAPLE_INGEST_KEYS`. Each endpoint needs exactly one key, so if the filtered (non-empty) lists differ in length the parser bails with both counts. This guarantees endpoint/key pairing is never implicit.
Source
Thrown at src/codex_telemetry.rs:285
env_non_empty_with_store("FLOW_CODEX_MAPLE_TRACES_ENDPOINTS", &mut personal_env)
.map(|raw| {
raw.split(',')
.map(|value| value.trim().to_string())
.filter(|value| !value.is_empty())
.collect::<Vec<_>>()
})
.unwrap_or_default();
let csv_keys = env_non_empty_with_store("FLOW_CODEX_MAPLE_INGEST_KEYS", &mut personal_env)
.map(|raw| {
raw.split(',')
.map(|value| value.trim().to_string())
.filter(|value| !value.is_empty())
.collect::<Vec<_>>()
})
.unwrap_or_default();
if !csv_endpoints.is_empty() || !csv_keys.is_empty() {
if csv_endpoints.len() != csv_keys.len() {
anyhow::bail!(
"FLOW_CODEX_MAPLE_TRACES_ENDPOINTS count ({}) does not match FLOW_CODEX_MAPLE_INGEST_KEYS count ({})",
csv_endpoints.len(),
csv_keys.len()
);
}
for (endpoint, key) in csv_endpoints.into_iter().zip(csv_keys.into_iter()) {
targets.push(MapleIngestTarget {
traces_endpoint: endpoint,
ingest_key: key,
});
}
}
if targets.is_empty() {
return Ok(None);
}
targets.dedup_by(|a, b| a.traces_endpoint == b.traces_endpoint && a.ingest_key == b.ingest_key);View on GitHub (pinned to a747e741ae)
Solutions
- Make both CSV lists contain the same number of comma-separated, non-empty values
- Remove trailing commas and stray empty entries from either list
- Pair-check manually: split both on ',' and compare counts before exporting the env
Example fix
// before FLOW_CODEX_MAPLE_TRACES_ENDPOINTS=http://a:7281,http://b:7281, FLOW_CODEX_MAPLE_INGEST_KEYS=key-a # after (2 endpoints, 2 keys, no trailing comma) FLOW_CODEX_MAPLE_TRACES_ENDPOINTS=http://a:7281,http://b:7281 FLOW_CODEX_MAPLE_INGEST_KEYS=key-a,key-b
Defensive patterns
Strategy: validation
Validate before calling
fn csv_counts_match() -> bool {
let n = |name: &str| std::env::var(name).ok()
.map(|v| v.split(',').map(str::trim).filter(|s| !s.is_empty()).count())
.unwrap_or(0);
let (e, k) = (n("FLOW_CODEX_MAPLE_TRACES_ENDPOINTS"), n("FLOW_CODEX_MAPLE_INGEST_KEYS"));
(e == 0 && k == 0) || e == k
}
assert!(csv_counts_match(), "TRACES_ENDPOINTS and INGEST_KEYS must list equal non-empty counts"); Type guard
fn zip_csv_pairs<'a>(endpoints: &'a str, keys: &'a str) -> Option<Vec<(&'a str, &'a str)>> {
let e: Vec<_> = endpoints.split(',').map(str::trim).filter(|s| !s.is_empty()).collect();
let k: Vec<_> = keys.split(',').map(str::trim).filter(|s| !s.is_empty()).collect();
(e.len() == k.len()).then(|| e.into_iter().zip(k).collect())
} Try / catch
match telemetry::status() {
Err(e) if e.to_string().contains("does not match") => {
eprintln!("{} — align FLOW_CODEX_MAPLE_TRACES_ENDPOINTS with FLOW_CODEX_MAPLE_INGEST_KEYS", e);
Err(e)
}
other => other,
} Prevention
- Edit both CSV lists together and always add endpoint+key as a pair
- Avoid trailing commas and whitespace-only entries in the CSV values
- Keep the list definition in one templated file so counts can never drift
When it happens
Trigger: Calling `status`/`flush` where the two CSV env vars produce different numbers of non-empty entries after splitting on commas and filtering empty items.
Common situations: Adding a third endpoint but forgetting its key; trailing commas creating an implicit empty entry counted on one side only; whitespace-only entries removed by the filter on one list; stale counts after rotating keys.
Related errors
- FLOW_CODEX_MAPLE_LOCAL_ENDPOINT and FLOW_CODEX_MAPLE_LOCAL_I
- FLOW_CODEX_MAPLE_HOSTED_ENDPOINT and FLOW_CODEX_MAPLE_HOSTED
- 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/34ccf1e36f8426af.
Report an issue: GitHub.