{"record":{"id":"f94931872f6403fc","repo":"google-gemini/gemini-cli","slug":"extension-extension-name-cannot-be-updated-typ","errorCode":null,"errorMessage":"Extension ${extension.name} cannot be updated, type is unknown.","messagePattern":"Extension (.+?) cannot be updated, type is unknown\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/cli/src/config/extensions/update.ts","lineNumber":51,"sourceCode":"  currentState: ExtensionUpdateState,\n  dispatchExtensionStateUpdate: (action: ExtensionUpdateAction) => void,\n  enableExtensionReloading?: boolean,\n): Promise<ExtensionUpdateInfo | undefined> {\n  if (currentState === ExtensionUpdateState.UPDATING) {\n    return undefined;\n  }\n  dispatchExtensionStateUpdate({\n    type: 'SET_STATE',\n    payload: { name: extension.name, state: ExtensionUpdateState.UPDATING },\n  });\n  const installMetadata = loadInstallMetadata(extension.path);\n\n  if (!installMetadata?.type) {\n    dispatchExtensionStateUpdate({\n      type: 'SET_STATE',\n      payload: { name: extension.name, state: ExtensionUpdateState.ERROR },\n    });\n    throw new Error(\n      `Extension ${extension.name} cannot be updated, type is unknown.`,\n    );\n  }\n\n  try {\n    const status = await extensionManager.verifyExtensionIntegrity(\n      extension.name,\n      installMetadata,\n    );\n\n    if (status === IntegrityDataStatus.INVALID) {\n      throw new Error('Extension integrity cannot be verified');\n    }\n  } catch (e) {\n    dispatchExtensionStateUpdate({\n      type: 'SET_STATE',\n      payload: { name: extension.name, state: ExtensionUpdateState.ERROR },\n    });","sourceCodeStart":33,"sourceCodeEnd":69,"githubUrl":"https://github.com/google-gemini/gemini-cli/blob/5024443c7217464a66e98f80d73172a26440bd8f/packages/cli/src/config/extensions/update.ts#L33-L69","documentation":"Thrown by checkForExtensionUpdate when loadInstallMetadata(extension.path) returns undefined or an object with no type field. The update flow needs the recorded install type (git, github-release, local, link) to know how to fetch a new version, so a missing type is unrecoverable for updates.","triggerScenarios":"The extension directory has no install-metadata.json, the file is corrupt/unreadable (loadInstallMetadata swallows parse errors and returns undefined), or the JSON lacks a 'type' field.","commonSituations":"Manually copied/installed extension without metadata; metadata file deleted by a cleanup tool; older extension format predating the type field; corrupt JSON from an interrupted write.","solutions":["Reinstall the extension so a valid install-metadata.json with a type is written.","Manually restore or author install-metadata.json with the correct type (git/github-release/local/link).","Skip update checks for extensions known to lack metadata."],"exampleFix":"// before\nconst installMetadata = loadInstallMetadata(extension.path);\nif (!installMetadata?.type) throw new Error('...type is unknown');\n// after\nconst installMetadata = loadInstallMetadata(extension.path);\nif (!installMetadata?.type) {\n  return { name: extension.name, state: ExtensionUpdateState.UNKNOWN, canUpdate: false };","handlingStrategy":"type-guard","validationCode":"const meta = loadInstallMetadata(extension.path);\nif (!meta?.type) { /* skip update, mark unknown */ }","typeGuard":"function hasInstallType(meta?: ExtensionInstallMetadata): meta is ExtensionInstallMetadata & { type: ExtensionInstallMetadata['type'] } { return !!meta && typeof meta.type === 'string' && meta.type.length > 0; }","tryCatchPattern":"try { await checkForExtensionUpdate(ext, mgr); } catch (e) { if (/type is unknown/.test(String(e))) { /* exclude from update batch */ } else throw e; }","preventionTips":["Exclude extensions without metadata from update batches.","Reinstall extensions that lost their install-metadata.json."],"tags":["extensions","updates","metadata","config"],"backgroundTag":null,"analyzedSha":"5024443c7217464a66e98f80d73172a26440bd8f","analyzedAt":"2026-08-12T06:01:53.711Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}