microsoft/typescript-go · critical · Error

Could not find a TypeScript executable in the extension pack

Error message

Could not find a TypeScript executable in the extension package.

What it means

Thrown by getPackagedExePath in the extension's util.ts when neither lib/tsc nor lib/tsgo (plus .exe on Windows) exists under the extension root (or the nightly extension root). tryGetPackagedExePath stats both names and returns undefined on failure, so this error means the extension installation contains no language-server binary at all - the server can never start.

Source

Thrown at _extension/src/util.ts:86

    return tryGetPackagedExePath(extension.extensionUri, getBundledTypeScriptVersion(extension.packageJSON));
}

export async function getDefaultExePath(context: vscode.ExtensionContext): Promise<ExeInfo> {
    if (enableContributedNightlyVersion) {
        const nightlyExe = await getNightlyExePath();
        if (nightlyExe) {
            return nightlyExe;
        }
    }
    return getBuiltinExePath(context);
}

async function getPackagedExePath(extensionUri: vscode.Uri, version: unknown): Promise<ExeInfo> {
    const exe = await tryGetPackagedExePath(extensionUri, version);
    if (exe) {
        return exe;
    }
    throw new Error(vscode.l10n.t("Could not find a TypeScript executable in the extension package."));
}

function getBundledTypeScriptVersion(packageJSON: unknown): string {
    if (packageJSON && typeof packageJSON === "object" && "bundledTypeScriptVersion" in packageJSON) {
        const version = packageJSON.bundledTypeScriptVersion;
        if (typeof version === "string") {
            return version;
        }
    }
    return "unknown";
}

async function tryGetPackagedExePath(extensionUri: vscode.Uri, version: unknown): Promise<ExeInfo | undefined> {
    for (const baseName of packagedExeBaseNames) {
        const exeName = `${baseName}${process.platform === "win32" ? ".exe" : ""}`;
        const exePath = vscode.Uri.joinPath(extensionUri, "lib", exeName);
        try {
            await vscode.workspace.fs.stat(exePath);

View on GitHub (pinned to 1bcfa18d79)

Solutions

  1. Fully uninstall and reinstall the extension so the platform-specific VSIX with lib/tsgo is fetched
  2. If running from source, build the native binary first: hereby build (produces built/local/tsgo next to the repo)
  3. Verify the binary exists: ls <extensions dir>/typescript-native-preview-*/lib/tsgo (tsgo.exe on Windows)
  4. Confirm your OS/arch is supported by a tsgo prebuilt; if not, fall back to the built-in TypeScript extension
  5. Check antivirus/endpoint-protection logs for quarantine of the unsigned tsgo binary and allowlist it
Defensive patterns

Strategy: validation

Validate before calling

// Verify packaged binaries exist before attempting to start the server
import * as fs from 'fs';
import * as path from 'path';
const lib = path.join(extensionPath, 'lib');
const hasBinary = ['tsgo', 'tsc'].some(n => fs.existsSync(path.join(lib, n + (process.platform === 'win32' ? '.exe' : ''))));
if (!hasBinary) throw new Error('Extension install is missing lib/tsgo - reinstall the platform VSIX');

Try / catch

try {
    exe = await getBuiltinExePath(context);
} catch (e) {
    if (e instanceof Error && e.message.includes('Could not find a TypeScript executable')) {
        // guide reinstall instead of a silent fallback
        vscode.window.showErrorMessage('TypeScript 7 install incomplete - reinstall the extension.');
    } else throw e;
}

Prevention

When it happens

Trigger: VSIX installed without platform binaries (universal/web build on a desktop machine), extension files quarantined or pruned by antivirus/IT policy, corrupted marketplace download, dev-mode (ExtensionMode.Development) where ../built/local/tsgo was not built and the fallback lib lookup also fails.

Common situations: Unsupported platform (no prebuilt tsgo for that os/arch); nightly extension (TypeScriptTeam.vscode-typescript-nightly) installed with missing lib folder; running the extension from source without executing hereby build first; partially-synced extension directories.

Related errors


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