{"record":{"id":"f038289626fc7577","repo":"Hmbown/CodeWhale","slug":"agent-profile-field-cannot-be-empty","errorCode":null,"errorMessage":"agent profile {} {field} cannot be empty","messagePattern":"agent profile (.+?) (.+?) cannot be empty","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/fleet/profile.rs","lineNumber":525,"sourceCode":"            bail!(\n                \"agent profile {} may not request trust=true\",\n                path.display()\n            );\n        }\n        if permissions.approval_required == Some(false) {\n            bail!(\n                \"agent profile {} may not disable approval_required\",\n                path.display()\n            );\n        }\n    }\n    Ok(())\n}\n\nfn validate_agent_profile_token(path: &Path, field: &str, value: &str) -> Result<()> {\n    let trimmed = value.trim();\n    if trimmed.is_empty() {\n        bail!(\"agent profile {} {field} cannot be empty\", path.display());\n    }\n    if trimmed != value || !trimmed.chars().all(is_agent_profile_token_char) {\n        bail!(\n            \"agent profile {} {field} must be a simple token\",\n            path.display()\n        );\n    }\n    Ok(())\n}\n\nfn validate_agent_profile_model_hint(path: &Path, value: Option<&str>) -> Result<()> {\n    let Some(value) = value else {\n        return Ok(());\n    };\n    if !is_model_hint(value) {\n        bail!(\n            \"agent profile {} model must be a visible model id without whitespace or secrets\",\n            path.display()","sourceCodeStart":507,"sourceCodeEnd":543,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/fleet/profile.rs#L507-L543","documentation":"validate_agent_profile_token enforces that profile token fields (id, name, model-family style values) are non-empty after trimming. An empty or whitespace-only value in a token field fails profile parsing with this error.","triggerScenarios":"An agent profile TOML with an empty `id`/`name`/token field (id = \"\") or a value that is only whitespace, passed through load_agent_profile_identity_file or agent_profile_from_toml.","commonSituations":"A template profile file with placeholder left empty; a generated profile where a variable interpolation produced an empty string; deleting a value in an editor and saving.","solutions":["Set a non-empty value for the flagged field in the profile TOML","If a template/script generates the file, fix the interpolation so the field is populated","Remove the field if it is optional and you do not need it"],"exampleFix":"// before\nid = \"\"\n\n// after\nid = \"researcher\"","handlingStrategy":"validation","validationCode":"for (field, value) in [(\"id\", &profile.id), (\"name\", &profile.name)] {\n    if value.trim().is_empty() {\n        eprintln!(\"profile {field} cannot be empty\");\n    }\n}","typeGuard":"fn is_non_empty_token(s: &str) -> bool {\n    !s.trim().is_empty()\n}","tryCatchPattern":"match result {\n    Err(e) if e.to_string().contains(\"cannot be empty\") => {\n        eprintln!(\"fill in the empty token field in the profile TOML\");\n    }\n    other => other?,\n}","preventionTips":["Check template-generated profiles for unfilled placeholders before committing them","Never save a profile with an empty id or name field"],"tags":["fleet","agent-profiles","validation","empty-value"],"backgroundTag":"empty-required-field","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"}