remix-run/remix · error · CliError
Invalid completion request.
Error message
Invalid completion request.
What it means
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.
Source
Thrown at packages/cli/src/lib/commands/completion.ts:69
}
}
export function getCompletionCommandHelpText(target: NodeJS.WriteStream = process.stdout): string {
return formatHelpText(
{
description: 'Print a shell completion script for Remix.',
examples: ['remix completion bash >> ~/.bashrc', 'remix completion zsh >> ~/.zshrc'],
usage: ['remix completion <bash|zsh>'],
},
target,
)
}
function runCompletionPlumbing(argv: string[]): number {
try {
let [currentIndexArg, ...words] = argv
if (currentIndexArg == null || !/^\d+$/.test(currentIndexArg)) {
throw invalidCompletionRequest()
}
let currentIndex = Number(currentIndexArg)
process.stdout.write(renderCompletionResult(getCompletionResult(words, currentIndex)))
return 0
} catch (error) {
process.stderr.write(renderCliError(toCliError(error)))
return 1
}
}
View on GitHub (pinned to 9696913134)
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
Example fix
# before $ remix __complete -- 1 rem # wrong argument order # after # regenerate instead: $ remix completion bash >> ~/.bashrc && exec $SHELL
Defensive patterns
Strategy: validation
Validate before calling
function validPlumbingArgs(argv: string[]): boolean {
return argv.length > 0 && /^\d+$/.test(argv[0])
} Try / catch
try {
runCompletionPlumbing(argv)
} catch (error) {
if (/Invalid completion request/.test(error.message)) regenerateCompletionScript()
else throw error
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Unknown completion shell: ${shell}
- Missing app/routes.ts path.
- RMX_ROUTE_OWNER_PLAN_UNRESOLVED
- throw new AssertionError(options)
- ${matcherName} requires a mock function with a .mock.calls p
AI-assisted analysis of remix-run/remix@9696913134 (2026-08-27).
Data as JSON: /api/errors/d89e77b399f09fb0.
Report an issue: GitHub.