{"record":{"id":"91c25d800ab11f6a","repo":"google-gemini/gemini-cli","slug":"the-source-argument-must-be-provided-91c25d","errorCode":null,"errorMessage":"The source argument must be provided.","messagePattern":"The source argument must be provided\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/cli/src/commands/skills/install.ts","lineNumber":102,"sourceCode":"        describe:\n          'The scope to install the skill into. Defaults to \"user\" (global).',\n        choices: ['user', 'workspace'],\n        default: 'user',\n      })\n      .option('path', {\n        describe:\n          'Sub-path within the repository to install from (only used for git repository sources).',\n        type: 'string',\n      })\n      .option('consent', {\n        describe:\n          'Acknowledge the security risks of installing a skill and skip the confirmation prompt.',\n        type: 'boolean',\n        default: false,\n      })\n      .check((argv) => {\n        if (!argv.source) {\n          throw new Error('The source argument must be provided.');\n        }\n        return true;\n      }),\n  handler: async (argv) => {\n    await handleInstall({\n      // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion\n      source: argv['source'] as string,\n      // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion\n      scope: argv['scope'] as 'user' | 'workspace',\n      // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion\n      path: argv['path'] as string | undefined,\n      // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion\n      consent: argv['consent'] as boolean | undefined,\n    });\n    await exitCli();\n  },\n};\n","sourceCodeStart":84,"sourceCodeEnd":120,"githubUrl":"https://github.com/google-gemini/gemini-cli/blob/5024443c7217464a66e98f80d73172a26440bd8f/packages/cli/src/commands/skills/install.ts#L84-L120","documentation":"Thrown by the yargs `.check()` validator on the `gemini skills install <source>` command when the positional `source` argument is missing or falsy at parse time. It is a belt-and-suspenders guard that backs up the positional's `demandOption: true` declaration, covering edge cases where yargs still yields an undefined value (e.g. when source is coerced to empty). The handler rethrows so yargs surfaces it as a usage error.","triggerScenarios":"Running `gemini skills install` with no positional, with an empty string (`gemini skills install \"\"`), or programmatically invoking the `installCommand` builder with a `source` argument that resolves to a falsy value.","commonSituations":"Typing the command without the URL/path; shell quoting that strips the argument (`gemini skills install $EMPTY_VAR`); scripts that pass an unset environment variable as source; calling the command module directly in tests without a source.","solutions":["Supply a non-empty git URL or local path as the positional: `gemini skills install https://github.com/org/repo`.","If driving the command programmatically, ensure `argv.source` is a non-empty string before invoking the handler.","Check your shell expands the variable: `gemini skills install \"$SKILL_SRC\"` with `SKILL_SRC` set."],"exampleFix":"// before\ngemini skills install\n// after\ngemini skills install https://github.com/org/skill-repo","handlingStrategy":"validation","validationCode":"const source = typeof argv.source === 'string' ? argv.source.trim() : '';\nif (!source) {\n  console.error('Usage: gemini skills install <source>');\n  process.exit(2);\n}","typeGuard":"function hasSource(argv: unknown): argv is { source: string } {\n  return (\n    typeof argv === 'object' && argv !== null &&\n    typeof (argv as { source?: unknown }).source === 'string' &&\n    (argv as { source: string }).source.trim().length > 0\n  );\n}","tryCatchPattern":null,"preventionTips":["Always pass the positional source explicitly when invoking the command.","In scripts, gate the call on a non-empty check: `[ -n \"$SRC\" ]`.","Treat the `.check()` as a final safety net, not the primary validation."],"tags":["cli","yargs","skills","validation","argument"],"backgroundTag":null,"analyzedSha":"5024443c7217464a66e98f80d73172a26440bd8f","analyzedAt":"2026-08-12T06:01:53.711Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}