{"record":{"id":"7c91d967466964dc","repo":"Hmbown/CodeWhale","slug":"fleet-task-coordination-contracts-must-be-one-non-empty-line","errorCode":null,"errorMessage":"Fleet task '{}' coordination contracts must be one non-empty line of at most 128 characters","messagePattern":"Fleet task '(.+?)' coordination contracts must be one non-empty line of at most 128 characters","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/fleet/worker_runtime.rs","lineNumber":616,"sourceCode":"        bail!(\n            \"Fleet task '{}' metadata.coordination_contracts accepts at most 16 entries\",\n            task_spec.id\n        );\n    }\n    let mut contracts = Vec::new();\n    for value in values {\n        let Some(value) = value.as_str() else {\n            bail!(\n                \"Fleet task '{}' metadata.coordination_contracts must contain only strings\",\n                task_spec.id\n            );\n        };\n        let value = value.trim();\n        if value.is_empty()\n            || value.chars().count() > 128\n            || value.chars().any(|ch| matches!(ch, '\\0' | '\\r' | '\\n'))\n        {\n            bail!(\n                \"Fleet task '{}' coordination contracts must be one non-empty line of at most 128 characters\",\n                task_spec.id\n            );\n        }\n        if !contracts.iter().any(|contract| contract == value) {\n            contracts.push(value.to_string());\n        }\n    }\n    Ok(contracts)\n}\n\n/// Mint a [`FleetResolvedRoute`] snapshot for a fleet task (#3154).\n///\n/// This calls the existing hermetic resolver bridge\n/// ([`resolve_route_candidate`]) so the persisted route reflects the same\n/// resolution semantics the runtime would use, then records only non-sensitive\n/// shape (provider id/kind, model ids, protocol) combined with the already\n/// computed effective role/loadout/model-class intent. `source` is","sourceCodeStart":598,"sourceCodeEnd":634,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/fleet/worker_runtime.rs#L598-L634","documentation":"Fleet coordination contract strings attached to a task must be a single non-empty line of at most 128 characters with no NUL, CR, or LF characters. The library validates each trimmed contract value in fleet_coordination_contracts before storing it, because contracts are used as identifiers/labels across worker specs and must be safe for one-line contexts. This bail fires when any contract string for the task violates those bounds.","triggerScenarios":"Calling fleet_task_to_worker_spec_with_profiles (or the validate path) with a task whose coordination_contracts contains an empty/whitespace-only entry, an entry longer than 128 characters (chars, not bytes), or an entry containing '\\0', '\\r', or '\\n' (e.g. a multi-line pasted contract).","commonSituations":"Pasting a multi-line coordination contract from a shell or document; auto-generated contract names that exceed 128 chars; an empty contracts list serialized as a list with one blank string; CRLF line endings embedded in a contract from a Windows config file.","solutions":["Trim and inspect every entry of the task's coordination_contracts before building the spec; remove or split any entry over 128 chars.","Strip newlines/NUL characters, or reject multi-line contracts at config-load time.","If a contract needs more content, use an external document referenced by a short contract key.","Fail loud at configuration parse time so bad contracts never reach the runtime."],"exampleFix":"// before\ncontracts: vec![format!(\"long contract {}\", \"x\".repeat(200))]\n// after\ncontracts: vec![\"short-contract-key\".to_string()]","handlingStrategy":"validation","validationCode":"fn valid_contract(s: &str) -> bool {\n    let s = s.trim();\n    !s.is_empty()\n        && s.chars().count() <= 128\n        && !s.chars().any(|c| matches!(c, '\\0' | '\\r' | '\\n'))\n}","typeGuard":"fn as_contract(s: &str) -> Option<&str> {\n    let t = s.trim();\n    (!t.is_empty() && t.chars().count() <= 128 && !t.contains(['\\0','\\r','\\n'])).then_some(t)\n}","tryCatchPattern":"match build_worker_spec(task) {\n    Err(e) if e.to_string().contains(\"coordination contracts\") => warn!(\"task {}: fix contract strings (one line, <=128 chars)\", task.id),\n    Err(e) => return Err(e),\n    Ok(spec) => spec,\n}","preventionTips":["Validate contract strings at config-parse time, not task-launch time","Enforce one-line input fields in any UI that collects contracts","Add a schema/length check in CI for fleet config fixtures"],"tags":["fleet","validation","config"],"backgroundTag":"invalid-argument-value","analyzedSha":"73e0f67d83c59909b571efdfc88c4bc28c309cb1","analyzedAt":"2026-09-22T01:30:00.501Z","contentChangedAt":"2026-09-22T01:30:00.501Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}