nanocoai/nanoclaw · error · StdinJsonInputError

--stdin-json key " " conflicts with argv key " " after CLI…

Error message

--stdin-json key "${key}" conflicts with argv key "${argvKey}" after CLI key normalization

What it means

After CLI key normalization (the canonicalization crud.ts parsers apply, e.g. dashes/underscores or alias collapsing), a stdin key maps to the same canonical form as an argv key, so they would silently override each other.

Solutions

  1. Pick one spelling and keep that option in only one of argv or stdin JSON

Example fix

# before
ncl wirings create --agent-group a1 --stdin-json <<< '{"agent_group": "a2"}'
# after
ncl wirings create --stdin-json <<< '{"agent_group": "a2"}'
Defensive patterns

Strategy: validation

Validate before calling

const canon = (k: string) => k.replace(/-/g,'_');
if (argvCanon.has(canon(stdinKey))) throw new Error('normalized conflict');

Prevention

When it happens

Trigger: `--agent-group x` on argv plus {"agent_group": ...} in stdin JSON — same canonical key, different spelling.

Common situations: Mixing snake_case JSON keys with kebab-case flags for the same option.

Related errors


AI-assisted analysis of nanocoai/nanoclaw@294ef2aee8 (2026-08-28). Data as JSON: /api/errors/53e715d4797a42d1. Report an issue: GitHub.

Appendix: source

Thrown at src/cli/stdin-json.ts:122

  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)