yamadashy/repomix · error

WASM file not found for language ${langName}: ${wasmPath}

Error message

WASM file not found for language ${langName}: ${wasmPath}

What it means

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.

Source

Thrown at src/core/treeSitter/loadLanguage.ts:60

}

async function getWasmPath(langName: string): Promise<string> {
  const wasmBasePath = getWasmBasePath();

  let wasmPath: string;
  if (wasmBasePath) {
    // Use custom WASM path for bundled environments
    wasmPath = path.join(wasmBasePath, `tree-sitter-${langName}.wasm`);
  } else {
    // Use require.resolve for standard node_modules environments
    wasmPath = require.resolve(`@repomix/tree-sitter-wasms/out/tree-sitter-${langName}.wasm`);
  }

  try {
    await fs.access(wasmPath);
    return wasmPath;
  } catch {
    throw new Error(`WASM file not found for language ${langName}: ${wasmPath}`);
  }
}

View on GitHub (pinned to f465ad9093)

Solutions

  1. Verify the file exists at the printed path; reinstall the package that ships the wasms
  2. Correct the custom wasm base path environment/config if overridden
  3. Downgrade/align tree-sitter-wasms so the language's wasm is included
  4. For offline/bundled deployments, copy the grammar wasms into the expected directory

Example fix

// before
$ WASM_BASE_PATH=/opt/app/wasms repomix ...
// after (place missing grammar)
$ cp node_modules/tree-sitter-wasms/out/tree-sitter-python.wasm /opt/app/wasms/
Defensive patterns

Strategy: validation

Validate before calling

import { access, constants } from 'node:fs/promises';
const wasmPath = path.join(getWasmBasePath(), `tree-sitter-${langName}.wasm`);
try { await access(wasmPath, constants.R_OK); } catch { /* fix base path or reinstall wasms */ }

Try / catch

try {
  await loadLanguage(langName);
} catch (err) {
  if (String(err.message).includes('WASM file not found')) {
    console.error(`reinstall tree-sitter-wasms or fix WASM base path (was looking at ${err.message})`);
  } else throw err;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of yamadashy/repomix@f465ad9093 (2026-08-29). Data as JSON: /api/errors/f1807038b60bc3da. Report an issue: GitHub.