{"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":"validation","errorClass":"Error","httpStatus":null,"severity":"error","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/8321021c54d670126ce3b2969d5deb880b4b0c2a/scripts/memory.js#L124-L160","documentation":"oneValue in scripts/memory.js normalizes options that may appear at most once (e.g. a single --content or --status). Passing the same single-value option more than once yields '<label> may be provided only once.' The script refuses to guess which duplicate to keep.","triggerScenarios":"Running `node scripts/memory.js write --content \"a\" --content \"b\"` or repeating another single-value option tracked by oneValue via saveInput.","commonSituations":"Shell scripts appending flags in a loop without deduplicating, concatenating default flags with user-supplied flags, or typos where two similar flags both map to the same label.","solutions":["Provide the option only once, keeping the value you actually want.","Deduplicate flags in your wrapper script before invoking memory.js (e.g. keep the last occurrence).","If you want multiple values, check whether a repeatable option exists (REPEAT_OPTIONS, e.g. --tags) and use that instead.","Review generated command lines (CI logs) for duplicated flags from config merging."],"exampleFix":"// before\nnode scripts/memory.js write --content \"a\" --content \"b\"\n// after\nnode scripts/memory.js write --content \"b\"","handlingStrategy":"validation","validationCode":"const count = (arr, v) => arr.filter(a => a === v).length;\nif (count(args, '--content') > 1) throw new Error('--content may be provided only once');","typeGuard":null,"tryCatchPattern":"try { run(args); } catch (e) { if (e.message.includes('may be provided only once')) { console.error(`${e.message} Remove the duplicate flag.`); process.exitCode = 2; } else throw e; }","preventionTips":["Deduplicate flags when merging defaults with user input","Use repeatable options (e.g. --tags) for multi-value needs","Log the final argv in wrapper scripts for debugging"],"tags":["cli","duplicate-options","argument-parsing"],"backgroundTag":"invalid-cli-argument","analyzedSha":"8321021c54d670126ce3b2969d5deb880b4b0c2a","analyzedAt":"2026-09-16T10:08:13.343Z","contentChangedAt":"2026-09-16T10:08:13.343Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}