nanocoai/nanoclaw · error · StdinJsonInputError
--stdin-json key "${key}" is also supplied on argv
Error message
--stdin-json key "${key}" is also supplied on argv What it means
A key present in --stdin-json is also present as a direct argv flag; to avoid ambiguity about which value wins, the CLI rejects exact duplicates.
Source
Thrown at src/cli/stdin-json.ts:116
*/
function assertNoKeyConflicts(
stdinArgs: Readonly<Record<string, unknown>>,
argvArgs: Readonly<Record<string, unknown>>,
): void {
const argvKeysByCanonical = new Map<string, string>();
for (const key of Object.keys(argvArgs)) {
const canonical = canonicalArgKey(key);
if (!argvKeysByCanonical.has(canonical)) argvKeysByCanonical.set(canonical, key);
}
const stdinKeysByCanonical = new Map<string, string>();
for (const key of Object.keys(stdinArgs)) {
if (key === '__proto__') {
throw new StdinJsonInputError('--stdin-json key "__proto__" is not allowed');
}
if (Object.prototype.hasOwnProperty.call(argvArgs, key)) {
throw new StdinJsonInputError(`--stdin-json key "${key}" is also supplied on argv`);
}
const canonical = canonicalArgKey(key);
const argvKey = argvKeysByCanonical.get(canonical);
if (argvKey !== undefined) {
throw new StdinJsonInputError(
`--stdin-json key "${key}" conflicts with argv key "${argvKey}" after CLI key normalization`,
);
}
const priorStdinKey = stdinKeysByCanonical.get(canonical);
if (priorStdinKey !== undefined) {
throw new StdinJsonInputError(
`--stdin-json keys "${priorStdinKey}" and "${key}" conflict after CLI key normalization`,
);
}
stdinKeysByCanonical.set(canonical, key);
}View on GitHub (pinned to 294ef2aee8)
Solutions
- Remove the duplicate: keep each key either in argv or in stdin JSON, not both
Example fix
# before ncl groups update --id g1 --name a --stdin-json < patch.json # patch.json has "name" # after ncl groups update --id g1 --stdin-json < patch.json # patch.json has "name"
Defensive patterns
Strategy: validation
Validate before calling
for (const k of Object.keys(stdin)) {
if (Object.hasOwn(argv, k)) throw new Error(`duplicate key: ${k}`);
} Prevention
- Migrate flags into stdin JSON wholesale, don't split one option across both
When it happens
Trigger: `ncl groups update --id g1 --name a --stdin-json` where stdin JSON also contains "name" (or "id").
Common situations: Partial migration to --stdin-json where some flags were left on the command line.
Related errors
- --stdin-json key "${key}" conflicts with argv key "${argvKey
- --stdin-json input exceeds ${MAX_STDIN_JSON_BYTES} bytes
- --stdin-json input is empty
- --stdin-json input is not valid JSON
- --stdin-json input must be one JSON object
AI-assisted analysis of nanocoai/nanoclaw@294ef2aee8 (2026-08-28).
Data as JSON: /api/errors/ba2ac6f206bc635b.
Report an issue: GitHub.