{"record":{"id":"7e31275ca941761b","repo":"remix-run/remix","slug":"rmx-unexpected-argument-7e3127","errorCode":"RMX_UNEXPECTED_ARGUMENT","errorMessage":"Unexpected extra argument: ${argument}","messagePattern":"Unexpected extra argument: (.+?)","errorType":"validation","errorClass":"UsageError","httpStatus":null,"severity":"error","filePath":"packages/cli/src/lib/parse-args.ts","lineNumber":91,"sourceCode":"        continue\n      }\n\n      let next = argv[index + 1]\n      if (next == null || next.length === 0 || next.startsWith('-')) {\n        throw missingOptionValue(flag)\n      }\n\n      values[resolved.key] = next as ParsedArgsValues<definitions>[typeof resolved.key]\n      index += 1\n      continue\n    }\n\n    if (arg.startsWith('-')) {\n      throw unknownArgument(arg)\n    }\n\n    if (options.maxPositionals != null && positionals.length >= options.maxPositionals) {\n      throw unexpectedExtraArgument(arg)\n    }\n\n    positionals.push(arg)\n  }\n\n  return { options: values, positionals }\n}\n","sourceCodeStart":73,"sourceCodeEnd":99,"githubUrl":"https://github.com/remix-run/remix/blob/9696913134be3a4423513d2775f7b31d6917c049/packages/cli/src/lib/parse-args.ts#L73-L99","documentation":"Thrown when a positional argument appears after the command has already collected its maximum allowed number of positionals (`options.maxPositionals`). Extra positionals indicate the user passed more arguments than the command accepts.","triggerScenarios":"Passing more positional arguments than the command's `maxPositionals` limit, e.g. a third directory argument to a command accepting two.","commonSituations":"Unquoted shell globs expanding to multiple paths, or misunderstanding a command's argument count.","solutions":["Remove the extra positional argument(s)","Quote shell globs so they are not expanded into multiple positionals","Check the command usage/help for how many positionals it accepts"],"exampleFix":"# before\nremix generate route a b c\n# after\nremix generate route a","handlingStrategy":"validation","validationCode":"const MAX = 1\nconst positionals = argv.filter((a) => !a.startsWith('-'))\nif (positionals.length > MAX) throw new Error(`Expected at most ${MAX} positional argument(s)`)","typeGuard":null,"tryCatchPattern":"catch (error) {\n  if (error instanceof Error && error.code === 'RMX_UNEXPECTED_ARGUMENT') {\n    // print usage\n  }\n  throw error\n}","preventionTips":["Quote globs passed as single arguments","Validate argument count before invoking the command"],"tags":["cli","arguments","positional"],"backgroundTag":"invalid-cli-argument","analyzedSha":"9696913134be3a4423513d2775f7b31d6917c049","analyzedAt":"2026-08-27T19:55:01.024Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}