{"record":{"id":"79eff2ba82788459","repo":"affaan-m/ECC","slug":"command-does-not-accept-positional-arguments","errorCode":null,"errorMessage":"${command} does not accept positional arguments.","messagePattern":"(.+?) does not accept positional arguments\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/memory.js","lineNumber":135,"sourceCode":"        skipNext: true,\n      };\n    }\n    if (argument.startsWith('-')) {\n      throw new Error(`Unknown option: ${argument}`);\n    }\n    return { ...state, positionals: [...state.positionals, argument] };\n  }, { 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","sourceCodeStart":117,"sourceCodeEnd":153,"githubUrl":"https://github.com/affaan-m/ECC/blob/8321021c54d670126ce3b2969d5deb880b4b0c2a/scripts/memory.js#L117-L153","documentation":"requireNoPositionals enforces that subcommands like init, write, and doctor in scripts/memory.js take only named options, never bare positional arguments. If any positional tokens survive parsing, the command throws '<command> does not accept positional arguments.' This keeps the CLI contract strict and prevents silently ignoring stray arguments.","triggerScenarios":"Running `node scripts/memory.js write somefile.md --content \"x\"` or `node scripts/memory.js init default` — the bare tokens 'somefile.md'/'default' are positionals.","commonSituations":"Assuming the script accepts a file path argument like other tools, pasting commands from a different CLI, or an unquoted flag value that got split so part of it became positional.","solutions":["Remove the stray positional and express the intent as an option: `--content` / `--tags` etc.","If you meant to reference a file, check whether an option like --file exists; otherwise pipe the file via stdin (the script reads stdin for write).","Check shell quoting so a single flag value does not split into extra tokens.","Run `node scripts/memory.js --help` to see the accepted subcommand signatures."],"exampleFix":"// before\nnode scripts/memory.js write note.md --content \"x\"\n// after\necho \"x\" | node scripts/memory.js write --tags note","handlingStrategy":"validation","validationCode":"const COMMANDS_NO_POSITIONALS = new Set(['init','write','doctor']);\nconst positionals = args.filter(a => !a.startsWith('--') && a !== command);\nif (COMMANDS_NO_POSITIONALS.has(command) && positionals.length) throw new Error(`${command} takes no positional args`);","typeGuard":null,"tryCatchPattern":"try { run(args); } catch (e) { if (e.message.includes('does not accept positional arguments')) { console.error('Use named options instead of positional arguments'); process.exitCode = 2; } else throw e; }","preventionTips":["Review subcommand signatures before scripting","Quote flag values so they don't split into positionals","Pipe file contents via stdin instead of passing paths"],"tags":["cli","argument-parsing","positionals"],"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"}