{"record":{"id":"0aacb7f3aa2e6cfa","repo":"microsoft/typescript-go","slug":"executable-not-found-exe","errorCode":null,"errorMessage":"Executable not found: ${exe}","messagePattern":"Executable not found: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"critical","filePath":"_packages/native-preview/lib/getExePath.js","lineNumber":66,"sourceCode":"                const packageJsonPath = fileURLToPath(packageJson);\r\n                exeDir = path.join(path.dirname(packageJsonPath), \"lib\");\r\n            }\r\n        }\r\n        catch (e) {\r\n            throw new Error(\"Unable to resolve \" + platformPackageName + \". Either your platform is unsupported, or you are missing the package on disk.\");\r\n        }\r\n    }\r\n\r\n    let exe = path.join(exeDir, binName);\r\n    if (process.platform === \"win32\") {\r\n        exe += \".exe\";\r\n        if (exe.length >= 248) {\r\n            exe = \"\\\\\\\\?\\\\\" + exe;\r\n        }\r\n    }\r\n\r\n    if (!fs.existsSync(exe)) {\r\n        throw new Error(\"Executable not found: \" + exe);\r\n    }\r\n\r\n    return exe;\r\n}\r\n","sourceCodeStart":48,"sourceCodeEnd":71,"githubUrl":"https://github.com/microsoft/typescript-go/blob/1bcfa18d79a3be41772223d5c05dfe4480e614ff/_packages/native-preview/lib/getExePath.js#L48-L71","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Reinstall the platform package (remove node_modules/@typescript/native-preview-* and npm/yarn/pnpm install) to restore the binary","Check antivirus quarantine logs for tsgo/tsgo.exe and add an allowlist/exclusion for your project directory","Verify the file directly: ls node_modules/@typescript/native-preview-<platform>-<arch>/lib/tsgo(.exe)","If running inside the TypeScript repo, build artifacts first with hereby build","Bust stale CI caches for node_modules and reinstall"],"exampleFix":"# before\n# lib dir exists but binary was quarantined/never extracted\nls node_modules/@typescript/native-preview-linux-x64/lib/\n# -> package.json\n\n# after\nrm -rf node_modules/@typescript/native-preview-linux-x64 && npm install\nls node_modules/@typescript/native-preview-linux-x64/lib/\n# -> package.json  tsgo","handlingStrategy":"validation","validationCode":"// Pre-flight the exact binary path getExePath() will return\nimport fs from 'node:fs';\nimport path from 'node:path';\nconst exeDir = path.dirname(require.resolve('@typescript/native-preview/package.json'));\nconst exe = path.join(exeDir, '..', `native-preview-${process.platform}-${process.arch}`, 'lib', 'tsgo' + (process.platform === 'win32' ? '.exe' : ''));\nif (!fs.existsSync(exe)) throw new Error(`tsgo binary missing at ${exe} - reinstall the platform package`);","typeGuard":null,"tryCatchPattern":"try {\n    exe = getExePath();\n} catch (e) {\n    if (e instanceof Error && e.message.includes('Executable not found')) {\n        // dependency resolved but payload missing: reinstall + check AV quarantine\n        console.error(e.message, '- reinstall the platform package and check antivirus');\n    } else throw e;\n}","preventionTips":["Exclude the project directory from real-time antivirus scanning","Verify lib/tsgo presence in postinstall smoke tests","Do not prune 'unused' files from node_modules platform packages in Docker slims"],"tags":["binary","filesystem","antivirus","installation","native-preview"],"backgroundTag":null,"analyzedSha":"1bcfa18d79a3be41772223d5c05dfe4480e614ff","analyzedAt":"2026-08-16T02:12:00.115Z","schemaVersion":2},"datasetVersion":"2026-08-16T03:17:38.424Z"}