linshenkx/prompt-optimizer · error · RequestConfigError

Chrome built-in AI is not available in this browser.

Error message

Chrome built-in AI is not available in this browser.

What it means

Fallback error when the Chrome built-in AI availability status is neither 'available', 'downloadable', nor 'downloading' — e.g. 'unavailable' or the API is entirely missing. It uses status.error when present, otherwise this generic message.

Source

Thrown at packages/core/src/services/llm/adapters/chrome-built-in-adapter.ts:118

  protected getParameterDefinitions(_modelId: string): readonly ParameterDefinition[] {
    return []
  }

  protected getDefaultParameterValues(_modelId: string): Record<string, unknown> {
    return {}
  }

  private async createReadySession(initialPrompts?: ChromeLanguageModelPrompt[]) {
    const status = await checkChromeBuiltInAvailability()
    if (status.availability === 'downloadable') {
      throw new RequestConfigError('Chrome built-in AI model is not downloaded. Open the model manager and click download to prepare it.')
    }
    if (status.availability === 'downloading') {
      throw new RequestConfigError('Chrome built-in AI model is still downloading. Please wait for the download to finish.')
    }
    if (status.availability !== 'available') {
      throw new RequestConfigError(status.error || 'Chrome built-in AI is not available in this browser.')
    }

    return await createChromeBuiltInSession(initialPrompts?.length ? { initialPrompts } : {})
  }

  private buildPrompt(messages: Message[]): {
    initialPrompts?: ChromeLanguageModelPrompt[]
    prompt: ChromeLanguageModelPromptInput
  } {
    const normalizedMessages = messages
      .map((message) => ({
        role: message.role,
        content: message.content.trim()
      }))
      .filter((message) => message.content)
    const promptIndex = this.findPromptMessageIndex(normalizedMessages)
    const initialPrompts = normalizedMessages
      .filter((_message, index) => index !== promptIndex)

View on GitHub (pinned to 3e677b1d9f)

Solutions

  1. Verify you're on a Chrome version that ships the Prompt API (Dev/Canary or the enabled flag)
  2. Enable chrome://flags#prompt-api-for-gemini-nano and relaunch
  3. Check status.error from checkChromeBuiltInAvailability() for the precise reason
  4. Provide a feature check before offering the Chrome built-in provider in the UI, and fall back to a cloud adapter

Example fix

// before
const s = await adapter.session()

// after
import { checkChromeBuiltInAvailability } from '...'
const status = await checkChromeBuiltInAvailability()
if (status.availability !== 'available') {
  hideChromeBuiltInOption(status.error)
} else {
  const s = await adapter.session()
}
Defensive patterns

Strategy: validation

Validate before calling

const status = await checkChromeBuiltInAvailability()
if (status.availability !== 'available') disableChromeBuiltInProvider(status.error)

Type guard

function isChromeAIAvailable(): boolean {
  return typeof (window as any)?.ai?.languageModel?.create === 'function'
}

Try / catch

try { const s = await adapter.session() }
catch (e) {
  if (e instanceof RequestConfigError) return fallbackToCloudAdapter()
  throw e
}

Prevention

When it happens

Trigger: Calling session() in a non-Chrome browser, a Chrome build without the Prompt API, hardware/OS not supported, or the API disabled by enterprise policy.

Common situations: Firefox/Safari usage, stable Chrome where the flag is off, GPU/architecture requirements unmet, API surface removed in a newer Chrome canary.

Related errors


AI-assisted analysis of linshenkx/prompt-optimizer@3e677b1d9f (2026-08-27). Data as JSON: /api/errors/90ed99a39a888d7e. Report an issue: GitHub.