google-gemini/gemini-cli · error

The source argument must be provided.

Error message

The source argument must be provided.

What it means

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.

Source

Thrown at packages/cli/src/commands/skills/install.ts:102

        describe:
          'The scope to install the skill into. Defaults to "user" (global).',
        choices: ['user', 'workspace'],
        default: 'user',
      })
      .option('path', {
        describe:
          'Sub-path within the repository to install from (only used for git repository sources).',
        type: 'string',
      })
      .option('consent', {
        describe:
          'Acknowledge the security risks of installing a skill and skip the confirmation prompt.',
        type: 'boolean',
        default: false,
      })
      .check((argv) => {
        if (!argv.source) {
          throw new Error('The source argument must be provided.');
        }
        return true;
      }),
  handler: async (argv) => {
    await handleInstall({
      // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
      source: argv['source'] 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
      path: argv['path'] as string | undefined,
      // 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

  1. Supply a non-empty git URL or local path as the positional: `gemini skills install https://github.com/org/repo`.
  2. If driving the command programmatically, ensure `argv.source` is a non-empty string before invoking the handler.
  3. Check your shell expands the variable: `gemini skills install "$SKILL_SRC"` with `SKILL_SRC` set.

Example fix

// before
gemini skills install
// after
gemini skills install https://github.com/org/skill-repo
Defensive patterns

Strategy: validation

Validate before calling

const source = typeof argv.source === 'string' ? argv.source.trim() : '';
if (!source) {
  console.error('Usage: gemini skills install <source>');
  process.exit(2);
}

Type guard

function hasSource(argv: unknown): argv is { source: string } {
  return (
    typeof argv === 'object' && argv !== null &&
    typeof (argv as { source?: unknown }).source === 'string' &&
    (argv as { source: string }).source.trim().length > 0
  );
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of google-gemini/gemini-cli@5024443c72 (2026-08-12). Data as JSON: /api/errors/91c25d800ab11f6a. Report an issue: GitHub.