google-gemini/gemini-cli · error · Error

Extension ${extension.name} cannot be updated, type is unkno

Error message

Extension ${extension.name} cannot be updated, type is unknown.

What it means

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.

Source

Thrown at packages/cli/src/config/extensions/update.ts:51

  currentState: ExtensionUpdateState,
  dispatchExtensionStateUpdate: (action: ExtensionUpdateAction) => void,
  enableExtensionReloading?: boolean,
): Promise<ExtensionUpdateInfo | undefined> {
  if (currentState === ExtensionUpdateState.UPDATING) {
    return undefined;
  }
  dispatchExtensionStateUpdate({
    type: 'SET_STATE',
    payload: { name: extension.name, state: ExtensionUpdateState.UPDATING },
  });
  const installMetadata = loadInstallMetadata(extension.path);

  if (!installMetadata?.type) {
    dispatchExtensionStateUpdate({
      type: 'SET_STATE',
      payload: { name: extension.name, state: ExtensionUpdateState.ERROR },
    });
    throw new Error(
      `Extension ${extension.name} cannot be updated, type is unknown.`,
    );
  }

  try {
    const status = await extensionManager.verifyExtensionIntegrity(
      extension.name,
      installMetadata,
    );

    if (status === IntegrityDataStatus.INVALID) {
      throw new Error('Extension integrity cannot be verified');
    }
  } catch (e) {
    dispatchExtensionStateUpdate({
      type: 'SET_STATE',
      payload: { name: extension.name, state: ExtensionUpdateState.ERROR },
    });

View on GitHub (pinned to 5024443c72)

Solutions

  1. Reinstall the extension so a valid install-metadata.json with a type is written.
  2. Manually restore or author install-metadata.json with the correct type (git/github-release/local/link).
  3. Skip update checks for extensions known to lack metadata.

Example fix

// before
const installMetadata = loadInstallMetadata(extension.path);
if (!installMetadata?.type) throw new Error('...type is unknown');
// after
const installMetadata = loadInstallMetadata(extension.path);
if (!installMetadata?.type) {
  return { name: extension.name, state: ExtensionUpdateState.UNKNOWN, canUpdate: false };
Defensive patterns

Strategy: type-guard

Validate before calling

const meta = loadInstallMetadata(extension.path);
if (!meta?.type) { /* skip update, mark unknown */ }

Type guard

function hasInstallType(meta?: ExtensionInstallMetadata): meta is ExtensionInstallMetadata & { type: ExtensionInstallMetadata['type'] } { return !!meta && typeof meta.type === 'string' && meta.type.length > 0; }

Try / catch

try { await checkForExtensionUpdate(ext, mgr); } catch (e) { if (/type is unknown/.test(String(e))) { /* exclude from update batch */ } else throw e; }

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


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