{"record":{"id":"1bb719aeb6737080","repo":"linshenkx/prompt-optimizer","slug":"chrome-built-in-ai-model-is-still-downloading-ple","errorCode":null,"errorMessage":"Chrome built-in AI model is still downloading. Please wait for the download to finish.","messagePattern":"Chrome built-in AI model is still downloading\\. Please wait for the download to finish\\.","errorType":"exception","errorClass":"RequestConfigError","httpStatus":null,"severity":"warning","filePath":"packages/core/src/services/llm/adapters/chrome-built-in-adapter.ts","lineNumber":115,"sourceCode":"      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,\n        content: message.content.trim()\n      }))\n      .filter((message) => message.content)","sourceCodeStart":97,"sourceCodeEnd":133,"githubUrl":"https://github.com/linshenkx/prompt-optimizer/blob/3e677b1d9f7e0493c142c175560531e7ae786dce/packages/core/src/services/llm/adapters/chrome-built-in-adapter.ts#L97-L133","documentation":"The Chrome built-in AI model availability check returned 'downloading': Gemini Nano weights are currently being fetched but are not ready, so createReadySession refuses to create a session until the download completes.","triggerScenarios":"Calling session() while the on-device model component is mid-download; retrying immediately after triggering the download in the model manager.","commonSituations":"Impatient retry loops right after first enabling the feature; slow connections downloading the ~multi-GB component; multiple tabs racing the download.","solutions":["Wait for the download to complete (check chrome://components) and retry after it finishes","Poll availability on an interval instead of retrying immediately","Show download progress in the UI so users don't retry in a tight loop","Once complete, call session() again — no config change needed"],"exampleFix":"// before\nconst s = await adapter.session()\n\n// after\nasync function waitForReady(adapter, tries = 30) {\n  for (let i = 0; i < tries; i++) {\n    try { return await adapter.session() }\n    catch (e: any) {\n      if (e instanceof RequestConfigError && /still downloading/.test(e.message)) {\n        await new Promise(r => setTimeout(r, 5000)); continue\n      }\n      throw e\n    }\n  }\n  throw new Error('Model download did not finish in time')\n}","handlingStrategy":"retry","validationCode":"import { checkChromeBuiltInAvailability } from '...'\nconst status = await checkChromeBuiltInAvailability()\nif (status.availability === 'downloading') showSpinnerUntilAvailable()","typeGuard":"null","tryCatchPattern":"try { return await adapter.session() }\ncatch (e) {\n  if (e instanceof RequestConfigError && /still downloading/.test(e.message)) {\n    await sleep(5000); return adapter.session() // bounded retries\n  }\n  throw e\n}","preventionTips":["Poll availability instead of immediate retries","Track download progress via chrome://components","Never tight-loop session() on first use"],"tags":["chrome","gemini-nano","download-in-progress","prompt-api"],"backgroundTag":"browser-model-not-downloaded","analyzedSha":"3e677b1d9f7e0493c142c175560531e7ae786dce","analyzedAt":"2026-08-27T21:29:16.709Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}