{"record":{"id":"d89e77b399f09fb0","repo":"remix-run/remix","slug":"invalid-completion-request","errorCode":null,"errorMessage":"Invalid completion request.","messagePattern":"Invalid completion request\\.","errorType":"exception","errorClass":"CliError","httpStatus":null,"severity":"error","filePath":"packages/cli/src/lib/commands/completion.ts","lineNumber":69,"sourceCode":"  }\n}\n\nexport function getCompletionCommandHelpText(target: NodeJS.WriteStream = process.stdout): string {\n  return formatHelpText(\n    {\n      description: 'Print a shell completion script for Remix.',\n      examples: ['remix completion bash >> ~/.bashrc', 'remix completion zsh >> ~/.zshrc'],\n      usage: ['remix completion <bash|zsh>'],\n    },\n    target,\n  )\n}\n\nfunction runCompletionPlumbing(argv: string[]): number {\n  try {\n    let [currentIndexArg, ...words] = argv\n    if (currentIndexArg == null || !/^\\d+$/.test(currentIndexArg)) {\n      throw invalidCompletionRequest()\n    }\n\n    let currentIndex = Number(currentIndexArg)\n    process.stdout.write(renderCompletionResult(getCompletionResult(words, currentIndex)))\n    return 0\n  } catch (error) {\n    process.stderr.write(renderCliError(toCliError(error)))\n    return 1\n  }\n}\n","sourceCodeStart":51,"sourceCodeEnd":80,"githubUrl":"https://github.com/remix-run/remix/blob/9696913134be3a4423513d2775f7b31d6917c049/packages/cli/src/lib/commands/completion.ts#L51-L80","documentation":"The hidden completion-plumbing entrypoint expects a leading numeric current-word-index argument before the words to complete. If it is missing or fails the digits-only regex, the request is invalid. This path is normally invoked by the generated shell completion script, not by users.","triggerScenarios":"runCompletionPlumbing receives argv whose first element is null/undefined or not matching /^\\d+$/, e.g. an outdated or hand-edited completion script calling the plumbing with a different argument layout.","commonSituations":"A stale completion script from an older CLI version after upgrade; users manually invoking the plumbing command; a shell plugin that prepends flags before the index.","solutions":["Regenerate the completion script with the current CLI (remix completion bash) and reload the shell","Do not call the plumbing command manually; use the public completion command","Update the remix CLI so scripts and plumbing arguments match"],"exampleFix":"# before\n$ remix __complete -- 1 rem # wrong argument order\n\n# after\n# regenerate instead:\n$ remix completion bash >> ~/.bashrc && exec $SHELL","handlingStrategy":"validation","validationCode":"function validPlumbingArgs(argv: string[]): boolean {\n  return argv.length > 0 && /^\\d+$/.test(argv[0])\n}","typeGuard":null,"tryCatchPattern":"try {\n  runCompletionPlumbing(argv)\n} catch (error) {\n  if (/Invalid completion request/.test(error.message)) regenerateCompletionScript()\n  else throw error\n}","preventionTips":["Never invoke the plumbing entrypoint by hand; use the public completion command","Regenerate completion scripts after every CLI upgrade","Keep the shell plugin that sources the script versioned with the CLI version"],"tags":["cli","completion","shell","internal"],"backgroundTag":"completion-script-mismatch","analyzedSha":"9696913134be3a4423513d2775f7b31d6917c049","analyzedAt":"2026-08-27T19:55:01.024Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}