stablyai/orca · error · Error

Failed to delete model

Error message

Failed to delete model

What it means

Fallback error from deleteDictationModel when speech.models.delete fails and the host returned no error.message. Deletion is supposed to be idempotent on the host, so a real failure typically means the model file is locked, missing in a way the host refuses, or the host cannot update its catalog.

Source

Thrown at mobile/src/dictation/mobile-dictation-setup.ts:74

}

export async function downloadDictationModel(
  client: Pick<RpcClient, 'sendRequest'>,
  modelId: string
): Promise<void> {
  const response = await client.sendRequest('speech.models.download', { modelId })
  if (!response.ok) {
    throw new Error(response.error?.message || 'Failed to start download')
  }
}

export async function deleteDictationModel(
  client: Pick<RpcClient, 'sendRequest'>,
  modelId: string
): Promise<MobileSpeechSetup> {
  const response = await client.sendRequest('speech.models.delete', { modelId })
  if (!response.ok) {
    throw new Error(response.error?.message || 'Failed to delete model')
  }
  return (response as RpcSuccess).result as MobileSpeechSetup
}

export async function setDictationConfig(
  client: Pick<RpcClient, 'sendRequest'>,
  params: { enabled?: boolean; modelId?: string; dictationMode?: 'toggle' | 'hold' }
): Promise<MobileSpeechSetup> {
  const response = await client.sendRequest('speech.dictation.setup', params)
  if (!response.ok) {
    throw new Error(response.error?.message || 'Failed to update dictation settings')
  }
  return (response as RpcSuccess).result as MobileSpeechSetup
}

// A model is mid-download (or extracting) and the sheet should keep polling.
export function isModelInFlight(model: MobileSpeechModel): boolean {
  return model.status === 'downloading' || model.status === 'extracting'

View on GitHub (pinned to 1136503c6a)

Solutions

  1. Ensure no dictation session is active (status is idle) before deleting — stop any in-flight session first.
  2. If the model is the selectedModelId, call setDictationConfig to pick a different model (or disable) before deleting.
  3. Refresh setup via fetchDictationSetup to confirm the modelId is still listed; if it is already gone, treat as success.
  4. Check host permissions on the model cache directory.

Example fix

// before
const response = await client.sendRequest('speech.models.delete', { modelId })
if (!response.ok) {
  throw new Error(response.error?.message || 'Failed to delete model')
}

// after — treat already-gone as success
if (!response.ok) {
  const code = response.error?.code
  if (code === 'not_found') return (await fetchDictationSetup(client))
  throw new Error(response.error?.message || 'Failed to delete model')
}
Defensive patterns

Strategy: try-catch

Validate before calling

// Stop any active session and confirm the model is not selected
if (dictationStatus !== 'idle') await cancelDictation()
const setup = await fetchDictationSetup(client)
if (setup.selectedModelId === modelId) throw new Error('Cannot delete the selected model')

Type guard

function isDeleteModelError(err: unknown): boolean {
  return err instanceof Error && err.message === 'Failed to delete model'
}

Try / catch

try {
  return await deleteDictationModel(client, modelId)
} catch (err) {
  if (isDeleteModelError(err)) {
    showDeleteFailedToast(modelId)
    return await fetchDictationSetup(client)
  }
  throw err
}

Prevention

When it happens

Trigger: client.sendRequest('speech.models.delete', { modelId }) returns {ok:false} with no message; causes: modelId not in catalog, model file locked by an active dictation session, host lacks delete permission, model is currently selected and the host refuses to delete the active model.

Common situations: User tries to delete the currently selected model without first switching selection; a dictation session is running and holds the file open; the host catalog got out of sync with disk.

Related errors


AI-assisted analysis of stablyai/orca@1136503c6a (2026-08-12). Data as JSON: /api/errors/1832cf07c4083095. Report an issue: GitHub.