{"record":{"id":"b639f6f525bc3fbf","repo":"linshenkx/prompt-optimizer","slug":"chrome-built-in-ai-model-is-not-downloaded-open-t","errorCode":null,"errorMessage":"Chrome built-in AI model is not downloaded. Open the model manager and click download to prepare it.","messagePattern":"Chrome built-in AI model is not downloaded\\. Open the model manager and click download to prepare it\\.","errorType":"exception","errorClass":"RequestConfigError","httpStatus":null,"severity":"error","filePath":"packages/core/src/services/llm/adapters/chrome-built-in-adapter.ts","lineNumber":112,"sourceCode":"        }\n      })\n    } finally {\n      session.destroy?.()\n    }\n  }\n\n  protected getParameterDefinitions(_modelId: string): readonly ParameterDefinition[] {\n    return []\n  }\n\n  protected getDefaultParameterValues(_modelId: string): Record<string, unknown> {\n    return {}\n  }\n\n  private async createReadySession(initialPrompts?: ChromeLanguageModelPrompt[]) {\n    const status = await checkChromeBuiltInAvailability()\n    if (status.availability === 'downloadable') {\n      throw new RequestConfigError('Chrome built-in AI model is not downloaded. Open the model manager and click download to prepare it.')\n    }\n    if (status.availability === 'downloading') {\n      throw new RequestConfigError('Chrome built-in AI model is still downloading. Please wait for the download to finish.')\n    }\n    if (status.availability !== 'available') {\n      throw new RequestConfigError(status.error || 'Chrome built-in AI is not available in this browser.')\n    }\n\n    return await createChromeBuiltInSession(initialPrompts?.length ? { initialPrompts } : {})\n  }\n\n  private buildPrompt(messages: Message[]): {\n    initialPrompts?: ChromeLanguageModelPrompt[]\n    prompt: ChromeLanguageModelPromptInput\n  } {\n    const normalizedMessages = messages\n      .map((message) => ({\n        role: message.role,","sourceCodeStart":94,"sourceCodeEnd":130,"githubUrl":"https://github.com/linshenkx/prompt-optimizer/blob/3e677b1d9f7e0493c142c175560531e7ae786dce/packages/core/src/services/llm/adapters/chrome-built-in-adapter.ts#L94-L130","documentation":"createReadySession in the Chrome built-in AI adapter checks window.ai availability; when the underlying model reports 'downloadable', it means the Gemini Nano weights are not yet on the device and the adapter throws a RequestConfigError telling the user to download the model first.","triggerScenarios":"Starting a chat session (session() → createReadySession) in a Chrome/preview browser where Prompt API is exposed but the model was never downloaded; fresh browser profile; model was evicted after disk cleanup.","commonSituations":"Enabling chrome://flags#prompt-api-for-gemini-nano without downloading the model, using a new profile, Chrome Dev/Canary where the component is optional, insufficient disk space preventing auto-download.","solutions":["Open the model manager (or chrome://components → 'Optimization Guide On Device Model') and trigger the download, wait for it to finish","Ensure Chrome is up to date and the Prompt API flag is enabled","Free disk space and restart Chrome so the component can download","Catch RequestConfigError in the UI and show the download prompt instead of failing silently"],"exampleFix":"// before\nconst s = await adapter.session()\n\n// after\ntry {\n  const s = await adapter.session()\n} catch (e) {\n  if (e instanceof RequestConfigError && /not downloaded/.test(e.message)) {\n    showDownloadModelUI(); return\n  }\n  throw e\n}","handlingStrategy":"validation","validationCode":"import { checkChromeBuiltInAvailability } from '...'\nconst status = await checkChromeBuiltInAvailability()\nif (status.availability === 'downloadable') {\n  promptUserToDownloadModel() // instead of calling session()\n}","typeGuard":"null","tryCatchPattern":"try { const s = await adapter.session() }\ncatch (e) {\n  if (e instanceof RequestConfigError && /not downloaded/.test(e.message)) { promptDownload(); return }\n  throw e\n}","preventionTips":["Check availability before showing Chrome built-in as an option","Trigger model download on first setup of the provider","Surface download state in provider settings UI"],"tags":["chrome","gemini-nano","prompt-api","model-download"],"backgroundTag":"browser-model-not-downloaded","analyzedSha":"3e677b1d9f7e0493c142c175560531e7ae786dce","analyzedAt":"2026-08-27T21:29:16.709Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}