{"record":{"id":"386102874f888bf2","repo":"Hmbown/CodeWhale","slug":"deepseek-harness-credentials-line-is-not-key","errorCode":null,"errorMessage":"DeepSeek Harness credentials line {} is not `KEY: value`","messagePattern":"DeepSeek Harness credentials line (.+?) is not `KEY: value`","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/tui/src/dsh_credentials.rs","lineNumber":41,"sourceCode":"    let Some(text) = crate::external_credentials::read_to_string(grant)? else {\n        return Ok(None);\n    };\n    parse_dsh_deepseek_api_key(&text)\n}\n\n/// Strict subset of dsh-credentials-local: a mapping of POSIX identifiers to\n/// non-empty strings. Nested values, empty strings, and duplicate keys fail\n/// closed. Only `DEEPSEEK_API_KEY` is returned.\npub(crate) fn parse_dsh_deepseek_api_key(text: &str) -> Result<Option<String>> {\n    let mut found = None;\n    let mut seen = std::collections::BTreeSet::new();\n    for (index, raw) in text.lines().enumerate() {\n        let line = raw.trim();\n        if line.is_empty() || line.starts_with('#') {\n            continue;\n        }\n        let Some((key, value)) = line.split_once(':') else {\n            bail!(\n                \"DeepSeek Harness credentials line {} is not `KEY: value`\",\n                index + 1\n            );\n        };\n        let key = key.trim();\n        if !is_posix_identifier(key) {\n            bail!(\n                \"DeepSeek Harness credentials line {} has a non-identifier key\",\n                index + 1\n            );\n        }\n        if !seen.insert(key.to_string()) {\n            bail!(\"DeepSeek Harness credentials declare `{key}` more than once\");\n        }\n        let value = unquote_yaml_string(value.trim()).map_err(|reason| {\n            anyhow::anyhow!(\n                \"DeepSeek Harness credentials line {} is invalid: {reason}\",\n                index + 1","sourceCodeStart":23,"sourceCodeEnd":59,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/0c42157ee52f9d55af2b506d71b46249910f77d3/crates/tui/src/dsh_credentials.rs#L23-L59","documentation":"Thrown by parse_dsh_deepseek_api_key when a non-blank, non-comment line in the dsh credentials document has no ':' separator, so split_once(':') fails. The parser accepts a strict subset of dsh-credentials-local: each meaningful line must look like KEY: value; the error reports the 1-based line number.","triggerScenarios":"A line like \"DEEPSEEK_API_KEY=sk-abc\" (equals instead of colon) or a stray prose line such as \"credentials for prod\" in the granted file.","commonSituations":"Hand-editing the credentials file in .env syntax instead of the KEY: value YAML-ish form; pasting a JSON fragment or note into the file.","solutions":["Rewrite the offending line as KEY: value (colon separator)","Remove stray non-entry lines or prefix them with '#' to comment them out","Validate the file format with a YAML linter if unsure"],"exampleFix":"# before (line 3)\nDEEPSEEK_API_KEY=sk-abc\n\n# after\nDEEPSEEK_API_KEY: sk-abc","handlingStrategy":"validation","validationCode":"fn lint_dsh_credentials(text: &str) -> Result<()> {\n    for (index, raw) in text.lines().enumerate() {\n        let line = raw.trim();\n        if line.is_empty() || line.starts_with('#') {\n            continue;\n        }\n        if line.split_once(':').is_none() {\n            return Err(anyhow::anyhow!(\"line {}: expected 'KEY: value', got {line:?}\", index + 1));\n        }\n    }\n    Ok(())\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Write credentials in KEY: value form, never .env KEY=value form","Prefix notes and prose lines with '#'","Run the parser in a dry-run/lint mode after editing the file"],"tags":["rust","tui","credentials","parse-error","yaml","deepseek"],"backgroundTag":"credentials-file-parse-error","analyzedSha":"0c42157ee52f9d55af2b506d71b46249910f77d3","analyzedAt":"2026-08-20T21:50:45.477Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}