{"record":{"id":"888501df29b9b078","repo":"heygen-com/hyperframes","slug":"coreml-execution-provider-not-available-install-o","errorCode":null,"errorMessage":"CoreML execution provider not available. Install onnxruntime-node on Apple Silicon, or use --device cpu.","messagePattern":"CoreML execution provider not available\\. Install onnxruntime-node on Apple Silicon, or use --device cpu\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/cli/src/background-removal/manager.ts","lineNumber":41,"sourceCode":"export function isDevice(value: unknown): value is Device {\n  return typeof value === \"string\" && (DEVICES as readonly string[]).includes(value);\n}\n\nexport interface ProviderChoice {\n  providers: string[];\n  label: \"CoreML\" | \"CUDA\" | \"CPU\";\n}\n\nexport function selectProviders(device: Device = \"auto\"): ProviderChoice {\n  if (device === \"cpu\") return { providers: [\"cpu\"], label: \"CPU\" };\n\n  const available = listAvailableProviders();\n  const hasCoreML = available.includes(\"coreml\");\n  const hasCUDA = available.includes(\"cuda\");\n\n  if (device === \"coreml\") {\n    if (!hasCoreML) {\n      throw new Error(\n        \"CoreML execution provider not available. Install onnxruntime-node on Apple Silicon, or use --device cpu.\",\n      );\n    }\n    return { providers: [\"coreml\", \"cpu\"], label: \"CoreML\" };\n  }\n  if (device === \"cuda\") {\n    if (!hasCUDA) {\n      throw new Error(\n        \"CUDA execution provider not available. Use --device cpu or install an onnxruntime-node build with CUDA support.\",\n      );\n    }\n    return { providers: [\"cuda\", \"cpu\"], label: \"CUDA\" };\n  }\n\n  if (hasCoreML && platform() === \"darwin\" && arch() === \"arm64\") {\n    return { providers: [\"coreml\", \"cpu\"], label: \"CoreML\" };\n  }\n  if (hasCUDA) return { providers: [\"cuda\", \"cpu\"], label: \"CUDA\" };","sourceCodeStart":23,"sourceCodeEnd":59,"githubUrl":"https://github.com/heygen-com/hyperframes/blob/c2996c8626135db5253519359d8a063d3bafad8d/packages/cli/src/background-removal/manager.ts#L23-L59","documentation":"Thrown by selectProviders when the caller explicitly requests device 'coreml' but listAvailableProviders() does not include 'coreml'. CoreML is only reported as available on darwin-arm64 (Apple Silicon); on Intel Macs, Linux, or Windows the provider is absent. selectProviders is called by createSession, so this surfaces when the user passes --device coreml (or device: 'coreml') on a non-Apple-Silicon machine. The message directs the user to install onnxruntime-node on Apple Silicon or fall back to --device cpu.","triggerScenarios":"Passing device: 'coreml' on an Intel Mac (arch x64), Linux, or Windows; on Apple Silicon where the onnxruntime-node build lacks the CoreML EP (older version). selectProviders checks hasCoreML from listAvailableProviders which only adds 'coreml' on darwin + arm64.","commonSituations":"Hardcoding --device coreml in a CI runner that is Linux-based; an Intel-Mac developer copying config from an M-series colleague; an onnxruntime-node version that doesn't bundle CoreML.","solutions":["Use device: 'auto' (default) — it picks CoreML on Apple Silicon and CPU elsewhere.","On non-Apple-Silicon, pass device: 'cpu' explicitly.","On Apple Silicon where it still fails, upgrade onnxruntime-node to a build that ships the CoreML EP.","Gate the device choice on platform()/arch() in your config."],"exampleFix":"// before\nconst session = await createSession({ device: 'coreml' }); // on Linux\n\n// after\nimport { platform, arch } from 'node:os';\nconst device = platform() === 'darwin' && arch() === 'arm64' ? 'coreml' : 'cpu';\nconst session = await createSession({ device });","handlingStrategy":"type-guard","validationCode":"import { platform, arch } from 'node:os';\nfunction safeDevice(explicit?: string): 'coreml' | 'cpu' {\n  if (explicit === 'coreml' && platform() === 'darwin' && arch() === 'arm64') return 'coreml';\n  return 'cpu';\n}","typeGuard":"import { platform, arch } from 'node:os';\nconst coreMlAvailable = (): boolean =>\n  platform() === 'darwin' && arch() === 'arm64';","tryCatchPattern":null,"preventionTips":["Default to device: 'auto' — it selects CoreML on Apple Silicon and CPU elsewhere.","Gate an explicit 'coreml' on platform()==='darwin' && arch()==='arm64'.","On Intel Macs / Linux / Windows, pass 'cpu'."],"tags":["onnxruntime","background-removal","coreml","device","platform"],"backgroundTag":null,"analyzedSha":"c2996c8626135db5253519359d8a063d3bafad8d","analyzedAt":"2026-08-12T22:18:56.877Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}