{"record":{"id":"e50c91c5fbab9b14","repo":"google-gemini/gemini-cli","slug":"extension-newextensionname-is-already-install","errorCode":null,"errorMessage":"Extension \"${newExtensionName}\" is already installed. Please uninstall it first.","messagePattern":"Extension \"(.+?)\" is already installed\\. Please uninstall it first\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/cli/src/config/extension-manager.ts","lineNumber":314,"sourceCode":"        newExtensionConfig = await this.loadExtensionConfig(localSourcePath);\n\n        const newExtensionName = newExtensionConfig.name;\n        const previousName = previousExtensionConfig?.name ?? newExtensionName;\n        const previous = this.getExtensions().find(\n          (installed) => installed.name === previousName,\n        );\n        const nameConflict = this.getExtensions().find(\n          (installed) =>\n            installed.name === newExtensionName &&\n            installed.name !== previousName,\n        );\n\n        if (isUpdate && !previous) {\n          throw new Error(\n            `Extension \"${previousName}\" was not already installed, cannot update it.`,\n          );\n        } else if (!isUpdate && previous) {\n          throw new Error(\n            `Extension \"${newExtensionName}\" is already installed. Please uninstall it first.`,\n          );\n        } else if (isUpdate && nameConflict) {\n          throw new Error(\n            `Cannot update to \"${newExtensionName}\" because an extension with that name is already installed.`,\n          );\n        }\n\n        const newHasHooks = fs.existsSync(\n          path.join(localSourcePath, 'hooks', 'hooks.json'),\n        );\n        const previousHasHooks = !!(\n          isUpdate &&\n          previous &&\n          previous.hooks &&\n          Object.keys(previous.hooks).length > 0\n        );\n","sourceCodeStart":296,"sourceCodeEnd":332,"githubUrl":"https://github.com/google-gemini/gemini-cli/blob/5024443c7217464a66e98f80d73172a26440bd8f/packages/cli/src/config/extension-manager.ts#L296-L332","documentation":"Thrown on the fresh-install path (`isUpdate` is false) when an extension with the same `newExtensionName` is already loaded. The manager refuses to overwrite an installed extension silently; the user must uninstall first.","triggerScenarios":"Running `gemini extensions install owner/repo` for an extension whose manifest `name` collides with an already-installed one; reinstalling from a different source without uninstalling first.","commonSituations":"Installing the same extension from two different URLs/forks; a renamed source that ships the same `name` field in its manifest; reinstalling after a partial failure that left the prior install loaded.","solutions":["Uninstall the existing extension first: `gemini extensions uninstall <name>`.","If you want to switch sources, pass `previousExtensionConfig` so the call is treated as an update rather than a fresh install.","Confirm the manifest `name` field is unique across installed extensions."],"exampleFix":"// before\n$ gemini extensions install owner/repo-fork  # name collides with installed\n// after\n$ gemini extensions uninstall my-ext && gemini extensions install owner/repo-fork","handlingStrategy":"validation","validationCode":"const installed = extensionManager.getExtensions();\nif (!isUpdate && installed.some((e) => e.name === newExtensionName)) {\n  throw new Error(`${newExtensionName} already installed. Uninstall first.`);\n}","typeGuard":"function nameIsFree(name: string, installed: { name: string }[]): boolean {\n  return !installed.some((e) => e.name === name);\n}","tryCatchPattern":null,"preventionTips":["Check `getExtensions()` before issuing a fresh install.","Keep a single canonical source per extension `name`.","Uninstall before switching sources to keep state consistent."],"tags":["extensions","install","conflict"],"backgroundTag":null,"analyzedSha":"5024443c7217464a66e98f80d73172a26440bd8f","analyzedAt":"2026-08-12T06:01:53.711Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}