nanocoai/nanoclaw · error · StdinJsonInputError

--stdin-json keys "${priorStdinKey}" and "${key}" conflict a

Error message

--stdin-json keys "${priorStdinKey}" and "${key}" conflict after CLI key normalization

What it means

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.

Source

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

    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

  1. Keep one consistent key style in the JSON object (snake_case is typical)
  2. Delete the duplicate spelling and rerun

Example fix

# before
echo '{"agent_group":"a","agent-group":"b"}' | ncl wirings create --stdin-json
# after
echo '{"agent_group":"a"}' | ncl wirings create --stdin-json
Defensive patterns

Strategy: validation

Validate before calling

const seen = new Set<string>();
for (const k of Object.keys(obj)) {
  const c = k.replace(/-/g,'_');
  if (seen.has(c)) throw new Error(`duplicate canonical key: ${c}`);
  seen.add(c);
}

Prevention

When it happens

Trigger: --stdin-json input containing both snake_case and kebab-case spellings of the same option.

Common situations: JSON assembled from multiple sources with different key conventions.

Related errors


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