microsoft/typescript-go · critical · Error

Executable not found: ${exe}

Error message

Executable not found: ${exe}

What it means

Thrown by getExePath() as the final check: the platform package resolved successfully, but the expected executable (<exeDir>/lib/tsgo or tsc, plus .exe on Windows) does not exist on disk. Resolution succeeded while the payload is missing, which points to content-level corruption rather than a dependency-graph problem.

Source

Thrown at _packages/native-preview/lib/getExePath.js:66

                const packageJsonPath = fileURLToPath(packageJson);
                exeDir = path.join(path.dirname(packageJsonPath), "lib");
            }
        }
        catch (e) {
            throw new Error("Unable to resolve " + platformPackageName + ". Either your platform is unsupported, or you are missing the package on disk.");
        }
    }

    let exe = path.join(exeDir, binName);
    if (process.platform === "win32") {
        exe += ".exe";
        if (exe.length >= 248) {
            exe = "\\\\?\\" + exe;
        }
    }

    if (!fs.existsSync(exe)) {
        throw new Error("Executable not found: " + exe);
    }

    return exe;
}

View on GitHub (pinned to 1bcfa18d79)

Solutions

  1. Reinstall the platform package (remove node_modules/@typescript/native-preview-* and npm/yarn/pnpm install) to restore the binary
  2. Check antivirus quarantine logs for tsgo/tsgo.exe and add an allowlist/exclusion for your project directory
  3. Verify the file directly: ls node_modules/@typescript/native-preview-<platform>-<arch>/lib/tsgo(.exe)
  4. If running inside the TypeScript repo, build artifacts first with hereby build
  5. Bust stale CI caches for node_modules and reinstall

Example fix

# before
# lib dir exists but binary was quarantined/never extracted
ls node_modules/@typescript/native-preview-linux-x64/lib/
# -> package.json

# after
rm -rf node_modules/@typescript/native-preview-linux-x64 && npm install
ls node_modules/@typescript/native-preview-linux-x64/lib/
# -> package.json  tsgo
Defensive patterns

Strategy: validation

Validate before calling

// Pre-flight the exact binary path getExePath() will return
import fs from 'node:fs';
import path from 'node:path';
const exeDir = path.dirname(require.resolve('@typescript/native-preview/package.json'));
const exe = path.join(exeDir, '..', `native-preview-${process.platform}-${process.arch}`, 'lib', 'tsgo' + (process.platform === 'win32' ? '.exe' : ''));
if (!fs.existsSync(exe)) throw new Error(`tsgo binary missing at ${exe} - reinstall the platform package`);

Try / catch

try {
    exe = getExePath();
} catch (e) {
    if (e instanceof Error && e.message.includes('Executable not found')) {
        // dependency resolved but payload missing: reinstall + check AV quarantine
        console.error(e.message, '- reinstall the platform package and check antivirus');
    } else throw e;
}

Prevention

When it happens

Trigger: Antivirus quarantined or deleted the unsigned tsgo.exe; production installs/pruning that strip binaries out of lib; partially extracted node_modules or truncated downloads; running from a repo-shaped checkout where the matched built/npm layout lacks the freshly built artifacts.

Common situations: Windows Defender/endpoint tools removing the Go binary; npm cache corruption delivering an empty lib directory; 'slim' Docker stages copying package.json without lib; CI caches that cached node_modules before postinstall artifacts landed.

Related errors


AI-assisted analysis of microsoft/typescript-go@1bcfa18d79 (2026-08-16). Data as JSON: /api/errors/0aacb7f3aa2e6cfa. Report an issue: GitHub.