google-gemini/gemini-cli · error
The path argument must be provided.
Error message
The path argument must be provided.
What it means
Thrown by the yargs `.check()` validator on the `gemini skills link <path>` command when the positional `path` argument is missing or falsy. Like the install command, it backs up the positional's `demandOption: true` and ensures the handler never runs against an undefined path. Linking creates a symlink to a local skill directory, so a missing path has no valid target.
Source
Thrown at packages/cli/src/commands/skills/link.ts:80
describe: 'The local path of the skill to link.',
type: 'string',
demandOption: true,
})
.option('scope', {
describe:
'The scope to link the skill into. Defaults to "user" (global).',
choices: ['user', 'workspace'],
default: 'user',
})
.option('consent', {
describe:
'Acknowledge the security risks of linking a skill and skip the confirmation prompt.',
type: 'boolean',
default: false,
})
.check((argv) => {
if (!argv.path) {
throw new Error('The path argument must be provided.');
}
return true;
}),
handler: async (argv) => {
await handleLink({
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
path: argv['path'] as string,
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
scope: argv['scope'] as 'user' | 'workspace',
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
consent: argv['consent'] as boolean | undefined,
});
await exitCli();
},
};
View on GitHub (pinned to 5024443c72)
Solutions
- Provide a local directory path: `gemini skills link ./my-skill`.
- Verify the path exists and is non-empty before running: `[ -n "$P" ] && gemini skills link "$P"`.
- When calling the handler directly, populate `argv.path` with a non-empty string.
Example fix
// before gemini skills link // after gemini skills link /home/me/skills/my-skill
Defensive patterns
Strategy: validation
Validate before calling
const p = typeof argv.path === 'string' ? argv.path : '';
if (!p) {
console.error('Usage: gemini skills link <path>');
process.exit(2);
} Type guard
function hasLinkPath(argv: unknown): argv is { path: string } {
return (
typeof argv === 'object' && argv !== null &&
typeof (argv as { path?: unknown }).path === 'string' &&
(argv as { path: string }).path.length > 0
);
} Prevention
- Verify the path exists with `fs.existsSync` before linking.
- Quote path arguments to survive spaces.
- Use absolute paths to avoid ambiguity with `workspaceDir`.
When it happens
Trigger: Running `gemini skills link` with no positional, with an empty string, or invoking the `linkCommand` module without a populated `argv.path`.
Common situations: Forgetting the path argument; relative paths that the shell expands to nothing; copy-paste errors that drop the path; scripts that pass an unbound variable.
Related errors
- The source argument must be provided.
- The skill name must be provided.
- The --session-id option cannot be empty.
- Invalid scope: ${argv.scope}. Please use one of ${Object.val
- Invalid scope: ${argv.scope}. Please use one of ${Object.val
AI-assisted analysis of google-gemini/gemini-cli@5024443c72 (2026-08-12).
Data as JSON: /api/errors/2f2471b85d3e794d.
Report an issue: GitHub.