Case-sensitivity issue with `-e` flag for enabling extensions
What happened?
There is a case-sensitivity issue when enabling extensions using the -e or --extensions flag in Gemini CLI. If an extension's name in its gemini-extension.json file contains uppercase letters, it cannot be enabled using the -e flag, regardless of the case used in the command line.
Steps to reproduce:
- Create a Gemini CLI extension with a mixed-case name in its
gemini-extension.jsonfile. For example:{ "name": "MyExt", "version": "0.0.1", "mcpServers": { ... } } - Try to run Gemini CLI with this extension enabled, using any of the following commands:
gemini -e MyExtgemini -e myextgemini -e MYEXT
- Observe that the extension is not enabled.
What did you expect to happen?
The -e flag should be case-insensitive, and the extension should be enabled regardless of the casing used in the gemini-extension.json file or the command-line flag.
Client information
Client Information
Run gemini to enter the interactive CLI, then run the /about command.
> /about
╭────────────────────────────────────────────────────────────────────────────────────────╮
│ │
│ About Gemini CLI │
│ │
│ CLI Version 0.8.0-nightly.20250925.b1da8c21-git.d37fff7f │
│ Git Commit d37fff7f │
│ Model auto │
│ Sandbox no sandbox │
│ OS linux │
│ Auth Method gemini-api-key │
│ │
╰────────────────────────────────────────────────────────────────────────────────────────╯
Login information
No response
Anything else we need to know?
A user-provided workaround is to change the name field in the gemini-extension.json file to be all lowercase.
This appears to be a regression or a missed edge case from the recent refactoring in pull request #9994, which moved all handling of extension overrides into the ExtensionEnablementManager. That change was intended to fix an issue where disabled extensions could not be enabled with -e, but it seems to have introduced this new case-sensitivity problem.
Analysis
The issue is in the ExtensionEnablementManager class in packages/cli/src/config/extensions/extensionEnablement.ts.
The constructor of ExtensionEnablementManager correctly converts the extension names passed via the -e flag to lowercase. However, the isEnabled method performs a case-sensitive check. It compares the (potentially mixed-case) extensionName from the extension's config file directly against the list of lowercased extension names from the -e flag.
// packages/cli/src/config/extensions/extensionEnablement.ts
export class ExtensionEnablementManager {
// ...
constructor(configDir: string, enabledExtensionNames?: string[]) {
// ...
this.enabledExtensionNamesOverride =
enabledExtensionNames?.map((name) => name.toLowerCase()) ?? [];
}
// ...
isEnabled(extensionName: string, currentPath: string): boolean {
// ...
// If we have explicit overrides, only enable those extensions.
if (this.enabledExtensionNamesOverride.length > 0) {
return this.enabledExtensionNamesOverride.includes(extensionName); // This is case-sensitive
}
// ...
}
}
cc: @jakemac53 on possible regression
looking into it!
Looking at the previous code, it was also kind of all over the place here and I think did not actually allow enabling an extension using lower case - you always had to use the exact case that the extension used. However it wouldn't have reported the unmatched extension names in that case.
I think the best course of action here is probably just to require exact case matching and remove the toLowerCase calls entirely, because it gets weird when it comes to configuration files otherwise (should those also allow lower case matching?).
I disagree that allowing case-sensitivity is the correct course of action. This can be too confusing. We should simply consistently and uniformly use case-insensitive comparisons.
I believe the main place users will interact with these names is through config files - and it gets pretty weird if we want to start lower casing all the keys in maps, because now you can have duplicate keys etc.
Handling all those edge cases just does not seem worth it to me - this is already a niche feature and I don't want to overcomplicate it.
Yes @jakemac53, I believe keeping exact case would be a better choice here. It will give users more flexibility to configure their extensions accordingly.
If we are committing to exact case, a fix should need to document this new behavior clearly. I have seen several cases where people have already (cc: @bbiggs) been using the lowercase name for extensions, while the names in the configuration is CamelCase inside the file. If we now begin enforce exact case, this can cause breakage with existing behavior so a clear documentation would become a must. Allowing two different extensions, MyTool and mytool seems confusing.
My preference is that both extension names and MCP server names should have a limited grammar of allowed characters and be case insensitive, across configuration and command line flags.
As prior art, to my knowledge vscode extension names are case insensitive, as are pip package names. This is useful and important for dependency tracking.
For the immediate term I will just restore the behavior previously to avoid breaking any flows, and then we should separately reconcile things so that this command line argument doesn't behave differently from the rest of the system.
Yes, but won't think revert the ability for -e to enable an extension that is configured as disabled? This is critical for my workflow to enable an extension just for a particular non-interactive session; and I have been filing several bugs to allow this to work.
Yes, but won't think revert the ability for
-eto enable an extension that is configured as disabled? This is critical for my workflow to enable an extension just for a particular non-interactive session; and I have been filing several bugs to allow this to work.
This isn't just a revert, it just restores the case insensitive match (see https://github.com/google-gemini/gemini-cli/pull/10249). There are also tests now.