{"record":{"id":"e206bd0dfed1425f","repo":"nanocoai/nanoclaw","slug":"stdin-json-keys-priorstdinkey-and-key-e206bd","errorCode":null,"errorMessage":"--stdin-json keys \"${priorStdinKey}\" and \"${key}\" conflict after CLI key normalization","messagePattern":"--stdin-json keys \"(.+?)\" and \"(.+?)\" conflict after CLI key normalization","errorType":"validation","errorClass":"StdinJsonInputError","httpStatus":null,"severity":"error","filePath":"src/cli/stdin-json.ts","lineNumber":129,"sourceCode":"    if (key === '__proto__') {\n      throw new StdinJsonInputError('--stdin-json key \"__proto__\" is not allowed');\n    }\n\n    if (Object.prototype.hasOwnProperty.call(argvArgs, key)) {\n      throw new StdinJsonInputError(`--stdin-json key \"${key}\" is also supplied on argv`);\n    }\n\n    const canonical = canonicalArgKey(key);\n    const argvKey = argvKeysByCanonical.get(canonical);\n    if (argvKey !== undefined) {\n      throw new StdinJsonInputError(\n        `--stdin-json key \"${key}\" conflicts with argv key \"${argvKey}\" after CLI key normalization`,\n      );\n    }\n\n    const priorStdinKey = stdinKeysByCanonical.get(canonical);\n    if (priorStdinKey !== undefined) {\n      throw new StdinJsonInputError(\n        `--stdin-json keys \"${priorStdinKey}\" and \"${key}\" conflict after CLI key normalization`,\n      );\n    }\n    stdinKeysByCanonical.set(canonical, key);\n  }\n}\n","sourceCodeStart":111,"sourceCodeEnd":136,"githubUrl":"https://github.com/nanocoai/nanoclaw/blob/294ef2aee85218b23ad30eda9dfe10e590b54a8c/src/cli/stdin-json.ts#L111-L136","documentation":"Two keys inside the same stdin JSON object canonicalize to the same CLI argument key (e.g. \"agent_group\" and \"agent-group\" both present), so the parser could not pick one deterministically.","triggerScenarios":"--stdin-json input containing both snake_case and kebab-case spellings of the same option.","commonSituations":"JSON assembled from multiple sources with different key conventions.","solutions":["Keep one consistent key style in the JSON object (snake_case is typical)","Delete the duplicate spelling and rerun"],"exampleFix":"# before\necho '{\"agent_group\":\"a\",\"agent-group\":\"b\"}' | ncl wirings create --stdin-json\n# after\necho '{\"agent_group\":\"a\"}' | ncl wirings create --stdin-json","handlingStrategy":"validation","validationCode":"const seen = new Set<string>();\nfor (const k of Object.keys(obj)) {\n  const c = k.replace(/-/g,'_');\n  if (seen.has(c)) throw new Error(`duplicate canonical key: ${c}`);\n  seen.add(c);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Normalize all JSON keys to snake_case before assembling payloads"],"tags":["cli","stdin-json","duplicate-key","normalization"],"backgroundTag":"conflicting-arguments","analyzedSha":"294ef2aee85218b23ad30eda9dfe10e590b54a8c","analyzedAt":"2026-08-28T13:59:10.357Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}