google-gemini/gemini-cli · error

The source argument must be provided.

Error message

The source argument must be provided.

What it means

The 'gemini extensions install' command requires a <source> positional argument (a git URL or local path). A yargs .check() throws if argv.source is falsy, serving as a redundant guard alongside demandOption: true on the positional.

Source

Thrown at packages/cli/src/commands/extensions/install.ts:207

      })
      .option('pre-release', {
        describe: 'Enable pre-release versions for this extension.',
        type: 'boolean',
      })
      .option('consent', {
        describe:
          'Acknowledge the security risks of installing an extension and skip the confirmation prompt.',
        type: 'boolean',
        default: false,
      })
      .option('skip-settings', {
        describe: 'Skip the configuration on install process.',
        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
      ref: argv['ref'] as string | undefined,
      // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
      autoUpdate: argv['auto-update'] as boolean | undefined,
      // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
      allowPreRelease: argv['pre-release'] as boolean | undefined,
      // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
      consent: argv['consent'] as boolean | undefined,
      // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
      skipSettings: argv['skip-settings'] as boolean | undefined,
    });

View on GitHub (pinned to 5024443c72)

Solutions

  1. Provide a source argument: 'gemini extensions install <git-url-or-local-path>'.
  2. Verify the source string is non-empty before invoking in scripts.

Example fix

// before
gemini extensions install  // missing source

// after
gemini extensions install https://github.com/user/ext.git
Defensive patterns

Strategy: validation

Validate before calling

function validateInstallArgs(source: string | undefined): string {
  if (!source) {
    throw new Error('A source (git URL or local path) is required.');
  }
  return source;
}

const validSource = validateInstallArgs(args.source);

Prevention

When it happens

Trigger: Running 'gemini extensions install' with no source argument. The demandOption should normally catch this first, but the check is a safety net.

Common situations: Forgetting the source argument; scripting error that omits the positional; yargs edge case where demandOption doesn't fire.

Related errors


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