Hmbown/CodeWhale · error
DeepSeek Harness credentials declare
Error message
DeepSeek Harness credentials declare `{key}` more than once What it means
`parse_dsh_deepseek_api_key` inserts each parsed key into a `seen` set and bails if the key was already present, rejecting duplicate declarations. Duplicate keys make the document ambiguous, so parsing stops rather than picking one silently.
Solutions
- Open the credentials document and delete the older duplicate line, keeping one authoritative value per key.
- Search the file for repeated key names (`grep -n 'DEEPSEEK_API_KEY'`) and deduplicate.
- If merging files, union the keys instead of concatenating the contents.
Example fix
// before DEEPSEEK_API_KEY: sk-old DEEPSEEK_API_KEY: sk-new // after DEEPSEEK_API_KEY: sk-new
Defensive patterns
Strategy: validation
Validate before calling
// detect duplicate keys before import
let mut seen = std::collections::HashSet::new();
for (i, line) in text.lines().enumerate() {
if let Some((k, _)) = line.trim().split_once(':') {
let k = k.trim();
assert!(seen.insert(k.to_string()), "duplicate key `{k}` at line {}", i + 1);
}
} Prevention
- When merging credentials files, deduplicate keys instead of concatenating.
- Replace old values in place rather than appending new lines for the same key.
- Grep for the key name before adding it to confirm it is not already declared.
When it happens
Trigger: A dsh credentials document declaring the same key twice, e.g. two `DEEPSEEK_API_KEY:` lines (possibly with different values) anywhere in the file.
Common situations: Appending a new key without removing the old line; merging two credentials files; copy-paste duplication during manual editing.
Understand the failure class
Background: Conflicting config options: "cannot be used together" — configuration validation errors across open-source libraries — this error's family across 162 libraries.
Related errors
- DeepSeek Harness credentials line
- DeepSeek API key not found. 1. Get a key: …
- DeepSeek Harness credentials line
- DeepSeek Harness credentials line
- DeepSeek Harness credentials line
AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22).
Data as JSON: /api/errors/db05df3a97dbe824.
Report an issue: GitHub.
Appendix: source
Thrown at crates/tui/src/dsh_credentials.rs:54
let line = raw.trim();
if line.is_empty() || line.starts_with('#') {
continue;
}
let Some((key, value)) = line.split_once(':') else {
bail!(
"DeepSeek Harness credentials line {} is not `KEY: value`",
index + 1
);
};
let key = key.trim();
if !is_posix_identifier(key) {
bail!(
"DeepSeek Harness credentials line {} has a non-identifier key",
index + 1
);
}
if !seen.insert(key.to_string()) {
bail!("DeepSeek Harness credentials declare `{key}` more than once");
}
let value = unquote_yaml_string(value.trim()).map_err(|reason| {
anyhow::anyhow!(
"DeepSeek Harness credentials line {} is invalid: {reason}",
index + 1
)
})?;
if value.is_empty() {
bail!(
"DeepSeek Harness credentials line {} has an empty value",
index + 1
);
}
if key == DEEPSEEK_API_KEY_REF {
found = Some(value);
}
}
Ok(found)View on GitHub (pinned to 73e0f67d83)