google-gemini/gemini-cli · error

Either an extension name or --all must be provided

Error message

Either an extension name or --all must be provided

What it means

The 'gemini extensions update' command requires either a positional <name> OR the --all flag; they are mutually exclusive (declared via .conflicts('name', 'all')). If neither is provided, the yargs .check() throws.

Source

Thrown at packages/cli/src/commands/extensions/update.ts:155

export const updateCommand: CommandModule = {
  command: 'update [<name>] [--all]',
  describe:
    'Updates all extensions or a named extension to the latest version.',
  builder: (yargs) =>
    yargs
      .positional('name', {
        describe: 'The name of the extension to update.',
        type: 'string',
      })
      .option('all', {
        describe: 'Update all extensions.',
        type: 'boolean',
      })
      .conflicts('name', 'all')
      .check((argv) => {
        if (!argv.all && !argv.name) {
          throw new Error('Either an extension name or --all must be provided');
        }
        return true;
      }),
  handler: async (argv) => {
    await handleUpdate({
      // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
      name: argv['name'] as string | undefined,
      // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
      all: argv['all'] as boolean | undefined,
    });
    await exitCli();
  },
};

View on GitHub (pinned to 5024443c72)

Solutions

  1. Provide a specific name: 'gemini extensions update my-ext'.
  2. Use --all to update every installed extension: 'gemini extensions update --all'.
  3. Do not combine name and --all (they conflict).

Example fix

// before
gemini extensions update  // no target

// after
gemini extensions update --all
Defensive patterns

Strategy: validation

Validate before calling

function validateUpdateArgs(name?: string, all?: boolean): void {
  if (!all && !name) {
    throw new Error('Provide an extension name or use --all.');
  }
  if (all && name) {
    throw new Error('Name and --all are mutually exclusive.');
  }
}

validateUpdateArgs(args.name, args.all);

Prevention

When it happens

Trigger: Running 'gemini extensions update' with no name positional and no --all flag. Providing both name and --all triggers a yargs conflicts error instead.

Common situations: Forgetting to specify what to update; scripting error; confusion about the command's required arguments.

Related errors


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