{"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":"anyhow::Error","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/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/dsh_credentials.rs#L39-L75","documentation":"parse_dsh_deepseek_api_key parses a YAML-like DeepSeek Harness credentials file line by line. Each `key: value` pair's value must be a valid unquoted YAML string; when unquote_yaml_string fails, the error wraps the reason with the 1-based line number. It lets the user pinpoint exactly which credentials line is malformed.","triggerScenarios":"A credentials file line whose value part fails YAML string unquoting (e.g. malformed quote escaping, stray characters) passed through deepseek_api_key_from_grant.","commonSituations":"Hand-edited credentials file with broken quotes around the API key; copy-paste introducing smart quotes or trailing characters; mixed quote styles like `key: \"value'`.","solutions":["Open the credentials file at the reported line number and fix the quoting of the value.","Use plain unquoted or double-quoted ASCII values for the API key fields.","Regenerate the credentials file rather than hand-editing it."],"exampleFix":"// before (credentials file, line 3)\napi_key: \"sk-abc'\n// after\napi_key: \"sk-abc\"","handlingStrategy":"validation","validationCode":"for (i, line) in credentials.lines().enumerate() {\n    if let Some((_, value)) = line.split_once(': ') {\n        if !(value.starts_with('\"') && value.ends_with('\"')) && value.contains(['\\'', '\"']) {\n            eprintln!(\"line {} has mixed/broken quotes\", i + 1);\n        }\n    }\n}","typeGuard":null,"tryCatchPattern":"match deepseek_api_key_from_grant(text) {\n    Err(e) if e.to_string().contains(\"credentials line\") => {\n        let line = e.to_string();\n        eprintln!(\"Fix the DeepSeek credentials file: {line}\");\n    }\n    other => other?,\n}","preventionTips":["Never hand-edit credentials files; regenerate them from the grant flow.","Keep API key values plain ASCII, double-quoted only.","Lint the credentials file with a YAML parser before use."],"tags":["config","parsing","yaml","deepseek"],"backgroundTag":"invalid-argument-format","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"}