Hmbown/CodeWhale · error
fleet task '{}' metadata.coordination_contracts accepts at m
Error message
fleet task '{}' metadata.coordination_contracts accepts at most 16 entries What it means
The `metadata.coordination_contracts` array exceeds the hard cap of 16 entries. The limit keeps the coordination surface of a fleet task small and auditable; entries beyond 16 are not silently dropped — the whole spec is rejected. Duplicate strings are deduplicated later, but the length check runs on the raw array before dedup.
Source
Thrown at crates/tui/src/fleet/worker_runtime.rs:389
Ok(if segments.is_empty() {
".".to_string()
} else {
segments.join("/")
})
}
fn fleet_coordination_contracts(task_spec: &FleetTaskSpec) -> Result<Vec<String>> {
let Some(value) = task_spec.metadata.get("coordination_contracts") else {
return Ok(Vec::new());
};
let Some(values) = value.as_array() else {
bail!(
"fleet task '{}' metadata.coordination_contracts must be an array of strings",
task_spec.id
);
};
if values.len() > 16 {
bail!(
"fleet task '{}' metadata.coordination_contracts accepts at most 16 entries",
task_spec.id
);
}
let mut contracts = Vec::new();
for value in values {
let Some(value) = value.as_str() else {
bail!(
"fleet task '{}' metadata.coordination_contracts must contain only strings",
task_spec.id
);
};
let value = value.trim();
if value.is_empty()
|| value.chars().count() > 128
|| value.chars().any(|ch| matches!(ch, '\0' | '\r' | '\n'))
{
bail!(View on GitHub (pinned to 0c42157ee5)
Solutions
- Trim the list to at most 16 entries, removing duplicates first so the cap counts unique contracts.
- Consolidate fine-grained contracts into broader ones (e.g. one "ledger" instead of per-table entries).
- If contracts are generated, cap the generator at 16 and log when it truncates.
Example fix
# before [metadata] coordination_contracts = ["a", "b", "c", ... 20 entries ...] # after [metadata] coordination_contracts = ["a", "b", "c"] # <= 16 unique entries
Defensive patterns
Strategy: validation
Validate before calling
const MAX_CONTRACTS: usize = 16;
fn contracts_within_limit(values: &[serde_json::Value]) -> bool {
values.len() <= MAX_CONTRACTS
} Prevention
- Deduplicate contracts before counting — the runtime's cap applies to the raw array.
- Model contracts as a small fixed enum/slug list, not an open-ended generated set.
- Fail loudly in generators when truncation would be needed rather than silently exceeding 16.
When it happens
Trigger: A spec listing 17+ contract strings, including duplicates (dedup happens after the count check, so 20 entries with 3 duplicates still fails).
Common situations: Generators enumerating every queue/topic as a contract; accumulated contracts from merging several task templates.
Related errors
- fleet task '{}' metadata.coordination_contracts must be an a
- fleet task '{}' metadata.coordination_contracts must contain
- fleet task '{}' coordination contracts must be one non-empty
- running tmux lane `{}` has incomplete pinned session metadat
- running tmux lane `{}` lacks pinned socket/session metadata;
AI-assisted analysis of Hmbown/CodeWhale@0c42157ee5 (2026-08-20).
Data as JSON: /api/errors/5f8affe74c15aa53.
Report an issue: GitHub.