{"record":{"id":"f1807038b60bc3da","repo":"yamadashy/repomix","slug":"wasm-file-not-found-for-language-langname-wa","errorCode":null,"errorMessage":"WASM file not found for language ${langName}: ${wasmPath}","messagePattern":"WASM file not found for language (.+?): (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/core/treeSitter/loadLanguage.ts","lineNumber":60,"sourceCode":"}\n\nasync function getWasmPath(langName: string): Promise<string> {\n  const wasmBasePath = getWasmBasePath();\n\n  let wasmPath: string;\n  if (wasmBasePath) {\n    // Use custom WASM path for bundled environments\n    wasmPath = path.join(wasmBasePath, `tree-sitter-${langName}.wasm`);\n  } else {\n    // Use require.resolve for standard node_modules environments\n    wasmPath = require.resolve(`@repomix/tree-sitter-wasms/out/tree-sitter-${langName}.wasm`);\n  }\n\n  try {\n    await fs.access(wasmPath);\n    return wasmPath;\n  } catch {\n    throw new Error(`WASM file not found for language ${langName}: ${wasmPath}`);\n  }\n}\n","sourceCodeStart":42,"sourceCodeEnd":63,"githubUrl":"https://github.com/yamadashy/repomix/blob/f465ad909315a22120636baf03fa5e28701a50cb/src/core/treeSitter/loadLanguage.ts#L42-L63","documentation":"getWasmPath verifies the computed grammar file exists with fs.access before returning it. If the .wasm for langName is absent at the resolved path, it throws 'WASM file not found for language <name>: <path>', naming both the language and the exact path checked.","triggerScenarios":"The wasm base path (default inside node_modules, or custom via env/config) does not contain the language's grammar file, or the filename for that language differs from the expected tree-sitter-<lang>.wasm.","commonSituations":"Production Docker images pruning optional deps; custom WASM_BASE_PATH misconfigured; a language whose grammar is not bundled in the installed tree-sitter-wasms version.","solutions":["Verify the file exists at the printed path; reinstall the package that ships the wasms","Correct the custom wasm base path environment/config if overridden","Downgrade/align tree-sitter-wasms so the language's wasm is included","For offline/bundled deployments, copy the grammar wasms into the expected directory"],"exampleFix":"// before\n$ WASM_BASE_PATH=/opt/app/wasms repomix ...\n// after (place missing grammar)\n$ cp node_modules/tree-sitter-wasms/out/tree-sitter-python.wasm /opt/app/wasms/","handlingStrategy":"validation","validationCode":"import { access, constants } from 'node:fs/promises';\nconst wasmPath = path.join(getWasmBasePath(), `tree-sitter-${langName}.wasm`);\ntry { await access(wasmPath, constants.R_OK); } catch { /* fix base path or reinstall wasms */ }","typeGuard":null,"tryCatchPattern":"try {\n  await loadLanguage(langName);\n} catch (err) {\n  if (String(err.message).includes('WASM file not found')) {\n    console.error(`reinstall tree-sitter-wasms or fix WASM base path (was looking at ${err.message})`);\n  } else throw err;\n}","preventionTips":["Verify custom wasm base paths exist and contain all required grammars at deploy time","Add a startup check that probes each supported language's wasm","Don't strip optional deps with .wasm files in Docker/CI builds","Pin tree-sitter-wasms versions known to include all bundled grammars"],"tags":["tree-sitter","wasm","missing-file"],"backgroundTag":"wasm-file-not-found","analyzedSha":"f465ad909315a22120636baf03fa5e28701a50cb","analyzedAt":"2026-08-29T01:27:42.024Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}