moeru-ai/airi · error · Error

WebGPU is required for this model but is not available in yo

Error message

WebGPU is required for this model but is not available in your browser

What it means

After the model id check passes, assertModelSupported verifies platform capability: models marked platform 'webgpu' require getWebGpuState().supported, which is true only when navigator.gpu exists. The throw means the selected model needs WebGPU but the current browser context does not expose it.

Source

Thrown at packages/stage-ui/src/libs/providers/providers/kokoro-local/index.ts:48

function getWebGpuState() {
  const capabilities = getCachedWebGPUCapabilities()
  return {
    supported: capabilities?.supported ?? (typeof navigator !== 'undefined' && Boolean(navigator.gpu)),
    fp16Supported: capabilities?.fp16Supported ?? false,
  }
}

function getModel(modelId: string) {
  return KOKORO_MODELS.find(model => model.id === modelId)
}

function assertModelSupported(modelId: string) {
  const model = getModel(modelId)
  if (!model)
    throw new Error(`Invalid model: ${modelId}. Must be one of: ${KOKORO_MODELS.map(item => item.id).join(', ')}`)

  if (model.platform === 'webgpu' && !getWebGpuState().supported)
    throw new Error('WebGPU is required for this model but is not available in your browser')

  return model
}

function progressInfo(progress: { file?: string, percent: number, loaded?: number, total?: number }): ProgressInfo {
  return {
    name: progress.file ?? '',
    file: progress.file ?? '',
    progress: progress.percent >= 0 ? progress.percent : 0,
    status: 'progress',
    loaded: progress.loaded ?? 0,
    total: progress.total ?? 0,
  }
}

let lastLoadedModelId: string | null = null

export const providerKokoroLocal = defineProvider({

View on GitHub (pinned to 677329427f)

Solutions

  1. Serve the app over https or use localhost so the context is secure
  2. Switch to a Chromium-based browser (Chrome/Edge 113+) or a WebGPU-capable Safari
  3. Select the non-WebGPU kokoro model variant instead
  4. Re-enable hardware acceleration or clear the GPU blocklist flag

Example fix

// before
model: 'kokoro-82m-webgpu' // selected in Firefox → throw

// after
const webgpu = typeof navigator !== 'undefined' && Boolean(navigator.gpu)
model: webgpu ? 'kokoro-82m-webgpu' : 'kokoro-82m' // wasm/onnx variant
Defensive patterns

Strategy: validation

Validate before calling

const webgpuSupported = typeof navigator !== 'undefined' && Boolean(navigator.gpu)
if (!webgpuSupported)
  hideModelsWithPlatform('webgpu') // only offer runnable variants

Try / catch

try {
  assertModelSupported(modelId)
}
catch (err) {
  if (err.message.includes('WebGPU'))
    modelId = KOKORO_MODELS.find(m => m.platform !== 'webgpu')!.id
}

Prevention

When it happens

Trigger: Firefox without WebGPU enabled; older Safari or Chromium builds predating WebGPU; page loaded over plain http on a non-localhost host, making the context insecure so navigator.gpu is undefined; GPU blocklisted or hardware acceleration disabled.

Common situations: Accessing a dev server from a phone or LAN IP over http; Firefox as the default browser; VMs or remote desktops without GPU passthrough; enterprise policies disabling GPU.

Related errors


AI-assisted analysis of moeru-ai/airi@677329427f (2026-08-18). Data as JSON: /api/errors/4a0c55bf51313aec. Report an issue: GitHub.