{"record":{"id":"fe53f80c06c4ec1f","repo":"Hmbown/CodeWhale","slug":"deepseek-harness-credentials-line-is-invalid","errorCode":null,"errorMessage":"DeepSeek Harness credentials line {} is invalid: {reason}","messagePattern":"DeepSeek Harness credentials line (.+?) is invalid: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/dsh_credentials.rs","lineNumber":57,"sourceCode":"        }\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\n            )\n        })?;\n        if value.is_empty() {\n            bail!(\n                \"DeepSeek Harness credentials line {} has an empty value\",\n                index + 1\n            );\n        }\n        if key == DEEPSEEK_API_KEY_REF {\n            found = Some(value);\n        }\n    }\n    Ok(found)\n}\n\nfn is_posix_identifier(value: &str) -> bool {","sourceCodeStart":39,"sourceCodeEnd":75,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/8880682c63083a91624de936797efa3ce9e498fd/crates/tui/src/dsh_credentials.rs#L39-L75","documentation":"While parsing DeepSeek Harness credentials `KEY: value` lines, the value is passed through `unquote_yaml_string`; any parse failure is reported with the 1-based line number and the underlying reason (dsh_credentials.rs:57). Key identifier syntax and duplicate keys were already validated, so this failure is specifically about the value's quoting.","triggerScenarios":"A value with an unterminated quote (`DEEPSEEK_API_KEY: \"sk-abc`), mismatched quote pairs, or escape sequences that `unquote_yaml_string` rejects.","commonSituations":"Hand-edited credentials file; copy-paste from docs or chat that mangles quotes; secrets containing quote characters pasted without proper quoting.","solutions":["Open the credentials file at the reported 1-based line","Write the value plain (`KEY: value`) when it has no special characters","Or wrap the value in one balanced pair of double quotes, escaping any inner quotes"],"exampleFix":"# before (line 3)\nDEEPSEEK_API_KEY: \"sk-abc\n# after\nDEEPSEEK_API_KEY: sk-abc123","handlingStrategy":"validation","validationCode":"fn credentials_lint(text: &str) -> Result<()> {\n    for (i, line) in text.lines().filter(|l| !l.trim().is_empty()).enumerate() {\n        let quotes = line.matches('\"').count();\n        anyhow::ensure!(quotes % 2 == 0, \"line {} has unbalanced quotes\", i + 1);\n    }\n    Ok(())\n}","typeGuard":"fn looks_like_credentials_line(line: &str) -> bool {\n    let mut parts = line.splitn(2, ':');\n    matches!(parts.next(), Some(k) if !k.trim().is_empty())\n        && matches!(parts.next(), Some(v) if !v.trim().is_empty())\n}","tryCatchPattern":"match load_dsh_credentials(&path) {\n    Ok(credentials) => credentials,\n    Err(err) if err.to_string().contains(\"credentials line\") => {\n        eprintln!(\"fix the quoting on the reported line: {err}\");\n        anyhow::bail!(\"credentials file rejected\");\n    }\n    Err(err) => return Err(err),\n}","preventionTips":["Generate credentials files with tooling instead of hand edits","Prefer plain unquoted values unless characters require quoting","Lint for unbalanced quotes before loading"],"tags":["config","credentials","yaml","parsing"],"backgroundTag":null,"analyzedSha":"8880682c63083a91624de936797efa3ce9e498fd","analyzedAt":"2026-08-16T11:31:27.956Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}