{"record":{"id":"4e007a1f94c9cea9","repo":"google-gemini/gemini-cli","slug":"invalid-scope-argv-scope-please-use-one-of-4e007a","errorCode":null,"errorMessage":"Invalid scope: ${argv.scope}. Please use one of ${Object.values(SettingScope).map((s) => s.toLowerCase()).join(', ')}.","messagePattern":"Invalid scope: (.+?)\\. Please use one of (.+?)\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/cli/src/commands/extensions/enable.ts","lineNumber":96,"sourceCode":"  builder: (yargs) =>\n    yargs\n      .positional('name', {\n        describe: 'The name of the extension to enable.',\n        type: 'string',\n      })\n      .option('scope', {\n        describe:\n          'The scope to enable the extension in. If not set, will be enabled in all scopes.',\n        type: 'string',\n      })\n      .check((argv) => {\n        if (\n          argv.scope &&\n          !Object.values(SettingScope)\n            .map((s) => s.toLowerCase())\n            .includes(argv.scope.toLowerCase())\n        ) {\n          throw new Error(\n            `Invalid scope: ${argv.scope}. Please use one of ${Object.values(\n              SettingScope,\n            )\n              .map((s) => s.toLowerCase())\n              .join(', ')}.`,\n          );\n        }\n        return true;\n      }),\n  handler: async (argv) => {\n    await handleEnable({\n      // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion\n      name: argv['name'] as string,\n      // eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion\n      scope: argv['scope'] as string,\n    });\n    await exitCli();\n  },","sourceCodeStart":78,"sourceCodeEnd":114,"githubUrl":"https://github.com/google-gemini/gemini-cli/blob/5024443c7217464a66e98f80d73172a26440bd8f/packages/cli/src/commands/extensions/enable.ts#L78-L114","documentation":"The 'gemini extensions enable' command's --scope option is validated identically to disable: against lowercased SettingScope enum values (user, workspace, system, systemdefaults, session). An unrecognized value fails the yargs .check() before the handler runs. Unlike disable, enable has no default scope (if omitted, it enables in all scopes).","triggerScenarios":"Running 'gemini extensions enable <name> --scope foo' where 'foo' is not a valid SettingScope value. The check is case-insensitive.","commonSituations":"Typo in scope name; passing an unsupported scope; confusion between scope names and other identifiers.","solutions":["Use one of the valid scope values (case-insensitive): user, workspace, system, systemdefaults, session.","Omit --scope to enable in all scopes.","Run 'gemini extensions enable --help' to see accepted values."],"exampleFix":"// before\ngemini extensions enable my-ext --scope global  // invalid\n\n// after\ngemini extensions enable my-ext --scope user  // valid","handlingStrategy":"validation","validationCode":"import { SettingScope } from '../../config/settings.js';\n\nfunction isValidScope(scope: string): boolean {\n  return Object.values(SettingScope)\n    .map((s) => s.toLowerCase())\n    .includes(scope.toLowerCase());\n}\n\n// Before calling enable:\nif (scope && !isValidScope(scope)) {\n  throw new Error(`Use one of: ${Object.values(SettingScope).map((s) => s.toLowerCase()).join(', ')}`);\n}","typeGuard":"import { SettingScope } from '../../config/settings.js';\n\nfunction isValidSettingScope(value: string): value is string {\n  return Object.values(SettingScope)\n    .map((s) => s.toLowerCase())\n    .includes(value.toLowerCase());\n}","tryCatchPattern":null,"preventionTips":["Use tab-completion or --help to see valid scope values.","Omit --scope entirely to enable in all scopes.","Remember valid values: user, workspace, system, systemdefaults, session."],"tags":["cli","extensions","scope","validation","yargs"],"backgroundTag":null,"analyzedSha":"5024443c7217464a66e98f80d73172a26440bd8f","analyzedAt":"2026-08-12T06:01:53.711Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}