{"record":{"id":"fb6a1856a8a47b8b","repo":"janhq/jan","slug":"not-a-cuda-runtime-archive-archivename-expect","errorCode":null,"errorMessage":"Not a CUDA runtime archive: ${archiveName}. Expected cudart-llama-bin-<backend>.(zip|tar.gz)","messagePattern":"Not a CUDA runtime archive: (.+?)\\. Expected cudart-llama-bin-<backend>\\.\\(zip\\|tar\\.gz\\)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"extensions/llamacpp-extension/src/index.ts","lineNumber":2966,"sourceCode":"  }\n\n  /**\n   * Install the supplementary CUDA runtime DLLs that upstream ships separately\n   * (`cudart-llama-bin-<backend>.zip`) into every installed backend of that\n   * type, so llama-server can resolve cublas/cudart at launch.\n   */\n  async installCudaRuntime(path: string): Promise<void> {\n    if (\n      !(await fs.existsSync(path)) ||\n      (!path.endsWith('tar.gz') && !path.endsWith('zip'))\n    ) {\n      throw new Error(`Invalid path or file ${path}`)\n    }\n\n    const archiveName = await basename(path)\n    const match = /^cudart-llama-bin-(.+?)\\.(?:tar\\.gz|zip)$/.exec(archiveName)\n    if (!match || !match[1]) {\n      throw new Error(\n        `Not a CUDA runtime archive: ${archiveName}. Expected cudart-llama-bin-<backend>.(zip|tar.gz)`\n      )\n    }\n    const backendType = match[1]\n\n    const targets = (await getLocalInstalledBackends()).filter(\n      (b) => b.backend === backendType\n    )\n    if (targets.length === 0) {\n      throw new Error(\n        `No installed \"${backendType}\" backend found. Install that backend first, then add the CUDA runtime.`\n      )\n    }\n\n    let installed = 0\n    for (const t of targets) {\n      const binDir = await joinPath([\n        await getBackendDir(t.backend, t.version),","sourceCodeStart":2948,"sourceCodeEnd":2984,"githubUrl":"https://github.com/janhq/jan/blob/fad3f12a147d138388a66f0d92a02b2675f65294/extensions/llamacpp-extension/src/index.ts#L2948-L2984","documentation":"Thrown by installCudaRuntime after the path passes the existence/extension pre-check but the basename does not match the regex ^cudart-llama-bin-(.+?)\\.(?:tar\\.gz|zip)$. The CUDA runtime is shipped as a separately downloadable archive whose filename encodes the target backend (e.g. cudart-llama-bin-vulkan.zip). This guard rejects anything that does not follow that naming contract so the backend type can be parsed safely in the next line.","triggerScenarios":"Calling installCudaRuntime(path) with an archive whose basename is missing the cudart-llama-bin- prefix, has no backend segment (cudart-llama-bin-.zip), uses an unsupported extension (.7z, .tar), or was renamed by the user/download manager (e.g. cudart.zip, llama-cuda-12.zip). The earlier extension/exists guard at line 2956 has already passed, so the file exists and ends in zip|tar.gz but the inner name is wrong.","commonSituations":"User manually downloaded the wrong artifact (e.g. a full backend bundle instead of the cudart runtime-only zip). CI/upstream renamed the release asset and the extension's downloader saved it under a different name. A proxy mirror re-packed the archive. Cross-platform confusion: pointing at a Windows .zip on Linux where the naming convention differs.","solutions":["Verify the archive basename matches exactly: cudart-llama-bin-<backend>.zip or .tar.gz (e.g. cudart-llama-bin-vulkan.zip).","Re-download the CUDA runtime asset from the upstream llama.cpp releases matching your installed backend, do not rename it.","If the file was renamed, rename it back to the original release filename before calling installCudaRuntime.","Confirm you are passing the path to the cudart runtime archive, not the main backend archive or model file."],"exampleFix":"// before\nawait ext.installCudaRuntime('/downloads/cuda-libs.zip')\n// after - rename to the contract the regex expects\nawait fs.rename('/downloads/cuda-libs.zip', '/downloads/cudart-llama-bin-vulkan.zip')\nawait ext.installCudaRuntime('/downloads/cudart-llama-bin-vulkan.zip')","handlingStrategy":"validation","validationCode":"// Validate the archive name contract BEFORE calling installCudaRuntime\nimport { basename } from 'path'\nconst CUDA_RT_RE = /^cudart-llama-bin-(.+?)\\.(?:tar\\.gz|zip)$/\nfunction assertCudaRuntimeArchive(p: string) {\n  const name = basename(p)\n  const m = CUDA_RT_RE.exec(name)\n  if (!m) throw new Error(`Refusing to call installCudaRuntime: '${name}' is not cudart-llama-bin-<backend>.(zip|tar.gz)`)\n  return m[1] // backendType\n}\nconst backendType = assertCudaRuntimeArchive(path)","typeGuard":"function isCudaRuntimeArchiveName(name: string): boolean {\n  return /^cudart-llama-bin-(.+?)\\.(?:tar\\.gz|zip)$/.test(name)\n}","tryCatchPattern":"try { await ext.installCudaRuntime(path) }\ncatch (e) {\n  if (/Not a CUDA runtime archive/.test(String(e))) { /* re-fetch the correctly-named asset */ }\n  else throw e\n}","preventionTips":["Never rename downloaded cudart archives - preserve the upstream release filename.","Keep the downloader that fetches the runtime aware of the naming contract so it can't save a misnamed file.","When surfacing a file picker for the runtime, filter by the cudart-llama-bin-* glob."],"tags":["cuda","archive","validation","backend","filename"],"backgroundTag":null,"analyzedSha":"fad3f12a147d138388a66f0d92a02b2675f65294","analyzedAt":"2026-08-12T20:33:47.516Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}