{"record":{"id":"d4e96750441472be","repo":"affaan-m/ECC","slug":"label-may-be-provided-only-once","errorCode":null,"errorMessage":"${label} may be provided only once.","messagePattern":"(.+?) may be provided only once\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"scripts/memory.js","lineNumber":142,"sourceCode":"  }, { options: {}, positionals: [], skipNext: false });\n\n  return {\n    command,\n    options: parsed.options,\n    positionals: parsed.positionals,\n  };\n}\n\nfunction requireNoPositionals(positionals, command) {\n  if (positionals.length > 0) {\n    throw new Error(`${command} does not accept positional arguments.`);\n  }\n}\n\nfunction oneValue(values, label, fallback = null) {\n  if (!values || values.length === 0) return fallback;\n  if (values.length > 1) {\n    throw new Error(`${label} may be provided only once.`);\n  }\n  return values[0];\n}\n\nfunction waitForStdinRetry(milliseconds) {\n  Atomics.wait(STDIN_RETRY_SIGNAL, 0, 0, milliseconds);\n}\n\nfunction readBoundedStdin(maxBytes, retryOptions = {}) {\n  const retryDelayMs = Number.isInteger(retryOptions.retryDelayMs)\n    && retryOptions.retryDelayMs > 0\n    ? retryOptions.retryDelayMs\n    : DEFAULT_STDIN_RETRY_DELAY_MS;\n  const maxRetryWaitMs = Number.isInteger(retryOptions.maxRetryWaitMs)\n    && retryOptions.maxRetryWaitMs >= 0\n    ? retryOptions.maxRetryWaitMs\n    : MAX_STDIN_RETRY_WAIT_MS;\n  const wait = typeof retryOptions.wait === 'function'","sourceCodeStart":124,"sourceCodeEnd":160,"githubUrl":"https://github.com/affaan-m/ECC/blob/01e15490f04e29cfefe3896951f43db46994d8ee/scripts/memory.js#L124-L160","documentation":"oneValue enforces that a single-value option (from VALUE_OPTIONS: --body-file, --from, --limit, --source-harness, --target-harness, --title) appears at most once. If the same flag is given twice it throws `${label} may be provided only once.` The repeatable flags (--kind, --link, --scope, --tag, --target) are intentionally excluded because they go through appendOption, so this only governs the non-repeatable set.","triggerScenarios":"Passing `--title a --title b`. A wrapper script concatenating two config sources each adding `--from ecc`. An alias plus an explicit flag both contributing `--target-harness`.","commonSituations":"Merging CLI args from multiple config layers without dedupe. Copy-pasting a flag twice. Shell history editing leaving a duplicate.","solutions":["Provide each single-value option exactly once.","Dedupe args in wrapper scripts before invoking memory.","Remember --kind/--tag/--link/--scope/--target are the repeatable ones; the others are not.","If you need to override, edit the previous occurrence rather than appending another."],"exampleFix":"# before\necc memory save --title \"A\" --title \"B\" --stdin\n\n# after\necc memory save --title \"A\" --stdin","handlingStrategy":"validation","validationCode":"const SINGLE_VALUE = new Set(['--body-file','--from','--limit','--source-harness','--target-harness','--title']);\nfunction assertSingleValueFlags(argv) {\n  const counts = new Map();\n  for (const a of argv) if (SINGLE_VALUE.has(a)) counts.set(a, (counts.get(a) || 0) + 1);\n  for (const [flag, n] of counts) if (n > 1) throw new Error(`${flag} may be provided only once.`);\n}","typeGuard":null,"tryCatchPattern":"try { runCommand(parsed); }\ncatch (err) { if (/may be provided only once\\./.test(err.message)) { usage(2); } else throw err; }","preventionTips":["Dedupe CLI args in wrapper scripts before invoking.","Remember repeatable flags are --kind/--tag/--link/--scope/--target only.","Edit a previous occurrence rather than appending a duplicate."],"tags":["cli","argument-parsing","memory-vault","usage"],"backgroundTag":null,"analyzedSha":"01e15490f04e29cfefe3896951f43db46994d8ee","analyzedAt":"2026-08-13T00:31:08.655Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}