{"record":{"id":"8807a69295c8e6af","repo":"cjpais/Handy","slug":"device-index-index-has-kind-other-which-can","errorCode":null,"errorMessage":"Device index {index} has kind '{other}', which cannot host a model","messagePattern":"Device index (.+?) has kind '(.+?)', which cannot host a model","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"src-tauri/src/managers/transcription.rs","lineNumber":1926,"sourceCode":"\n/// Resolve a `--list-devices` registry index to the (backend, gpu_device) pair\n/// for a transcribe-cpp model load (the `--device-index` flag). The\n/// backend is set explicitly from the device's kind, so there's no \"index 0 =\n/// auto\" ambiguity. Errors if the index isn't a registered, loadable device.\nfn resolve_device_index(index: usize) -> Result<(Backend, i32)> {\n    let device = transcribe_compute_devices()\n        .into_iter()\n        .find(|d| d.index == Some(index))\n        .ok_or_else(|| {\n            anyhow::anyhow!(\"No compute device with index {index} (see --list-devices)\")\n        })?;\n    let backend = match device.kind.as_str() {\n        \"cpu\" => Backend::Cpu,\n        \"metal\" => Backend::Metal,\n        \"cuda\" => Backend::Cuda,\n        \"vulkan\" => Backend::Vulkan,\n        other => {\n            return Err(anyhow::anyhow!(\n                \"Device index {index} has kind '{other}', which cannot host a model\"\n            ))\n        }\n    };\n    // gpu_device is a registry index used only by GPU backends; CPU ignores it.\n    let gpu_device = if matches!(backend, Backend::Cpu) {\n        0\n    } else {\n        index as i32\n    };\n    Ok((backend, gpu_device))\n}\n\n/// Map Handy's whisper accelerator setting to a transcribe-cpp [`Backend`].\n///\n/// `Auto` lets the library pick the best device (with CPU fallback). `Cpu` forces\n/// strict CPU. `Gpu` requests the platform GPU backend, but only if a device for\n/// it is actually registered — otherwise it falls back to `Auto` so the load","sourceCodeStart":1908,"sourceCodeEnd":1944,"githubUrl":"https://github.com/cjpais/Handy/blob/98a4d80cce8ad41efec2a419b59d9e81229a35d7/src-tauri/src/managers/transcription.rs#L1908-L1944","documentation":"resolve_device_index() found a device with the requested index, but its kind is not one of the four kinds Handy can map to a transcribe-cpp Backend (cpu, metal, cuda, vulkan). The registry advertises a device kind this Handy build cannot host a whisper model on — e.g. a new/preview backend kind registered by transcribe-cpp that the mapping here does not (yet) support.","triggerScenarios":"--device-index N resolves to a device whose kind string falls into the `other` arm of the match (anything except cpu/metal/cuda/vulkan): a newly introduced transcribe-cpp backend kind in a newer library, or an experimental/preview device registration.","commonSituations":"A transcribe-cpp update registers additional backend kinds (e.g. OpenCL-class devices) that Handy's mapping predates; mixing library versions; selecting an exotic device listed by --list-devices without checking its kind column.","solutions":["Run --list-devices and pick an index whose kind= is cpu, cuda, vulkan, or metal","Omit --device-index and use the accelerator setting instead, which routes through select_transcribe_backend's supported candidates","Update Handy — new backend kinds get mapped as support is added","If you control the build, extend the match in resolve_device_index with the new Backend variant"],"exampleFix":"// before (mapping in resolve_device_index)\nlet backend = match device.kind.as_str() {\n    \"cpu\" => Backend::Cpu,\n    \"metal\" => Backend::Metal,\n    \"cuda\" => Backend::Cuda,\n    \"vulkan\" => Backend::Vulkan,\n    other => return Err(anyhow::anyhow!(\"Device index {index} has kind '{other}', which cannot host a model\")),\n};\n\n// after — support the new kind once transcribe-cpp exposes a Backend for it\n    \"opencl\" => Backend::OpenCl,\n// (and prefer selecting a supported kind via --list-devices until then)","handlingStrategy":"validation","validationCode":"// Reject unsupported kinds before attempting the load\nconst HOSTABLE: [&str; 4] = [\"cpu\", \"metal\", \"cuda\", \"vulkan\"];\nlet device = transcribe_compute_devices().into_iter().find(|d| d.index == Some(index))\n    .ok_or_else(|| anyhow::anyhow!(\"No compute device with index {index} (see --list-devices)\"))?;\nanyhow::ensure!(HOSTABLE.contains(&device.kind.as_str()),\n    \"device {index} kind '{}' cannot host a model; pick cpu/cuda/vulkan/metal from --list-devices\", device.kind);","typeGuard":"// Narrow to devices Handy can actually host a whisper model on\nfn hostable_device(index: usize) -> Option<ComputeDevice> {\n    transcribe_compute_devices().into_iter()\n        .find(|d| d.index == Some(index) && matches!(d.kind.as_str(), \"cpu\" | \"metal\" | \"cuda\" | \"vulkan\"))\n}","tryCatchPattern":"match tm.load_model_with_device(&model_id, Some(index)) {\n    Err(e) if e.to_string().contains(\"cannot host a model\") => {\n        // fall back to the persisted accelerator setting instead of a pinned device\n        tm.load_model(&model_id)?\n    }\n    other => other?,\n}","preventionTips":["Read the kind= column of --list-devices, not just the index, before pinning a device","Prefer cpu/cuda/vulkan/metal devices when scripting --device-index","Update Handy when new transcribe-cpp backend kinds appear so the mapping gains support","If you build from source, keep resolve_device_index's match arms in sync with the Backend enum"],"tags":["rust","cli","gpu","device-index","transcribe-cpp","unsupported-backend"],"backgroundTag":"unsupported-device-type","analyzedSha":"98a4d80cce8ad41efec2a419b59d9e81229a35d7","analyzedAt":"2026-08-16T20:58:09.966Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}