{"record":{"id":"ded367599e7adf80","repo":"denoland/deno","slug":"failed-to-run-native-tsc-e","errorCode":null,"errorMessage":"failed to run native tsc: {e}","messagePattern":"failed to run native tsc: (.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"cli/tsc/native.rs","lineNumber":234,"sourceCode":"    .arg(\"--project\")\n    .arg(tsconfig_path)\n    .arg(\"--noEmit\")\n    .arg(\"--pretty\")\n    .arg(\"false\")\n    .arg(\"--diagnostics\")\n    .current_dir(project_root)\n    // The native compiler is written in Go, whose `os.Getwd` trusts the `PWD`\n    // environment variable over `getcwd()`. `current_dir` calls `chdir` but\n    // does not update the inherited `PWD`, so a symlinked launch directory\n    // (e.g. `/tmp` -> `/private/tmp` on macOS) would leave `PWD` pointing at\n    // the symlink and make tsc report every path relative to it. Pin `PWD` to\n    // the same directory we chdir'd into.\n    .env(\"PWD\", project_root)\n    .stdout(Stdio::piped())\n    .stderr(Stdio::piped())\n    .output()\n    .await\n    .map_err(|e| anyhow::anyhow!(\"failed to run native tsc: {e}\"))\n}\n\n/// A single `path(line,col): error TS####: message` line from `tsc --pretty\n/// false`. Continuation lines (indented elaborations) are folded into the\n/// preceding diagnostic's message.\nstatic DIAGNOSTIC_RE: LazyLock<Regex> = LazyLock::new(|| {\n  Regex::new(\n    r\"^(?P<file>.+?)\\((?P<line>\\d+),(?P<col>\\d+)\\): (?P<cat>error|warning|message) TS(?P<code>\\d+): (?P<msg>.*)$\",\n  )\n  .unwrap()\n});\n\n/// The position-less form (`error TS####: message`), e.g. `TS18003` (no\n/// inputs) or a `TS5###` config error.\nstatic DIAGNOSTIC_NO_POS_RE: LazyLock<Regex> = LazyLock::new(|| {\n  Regex::new(r\"^(?P<cat>error|warning|message) TS(?P<code>\\d+): (?P<msg>.*)$\")\n    .unwrap()\n});","sourceCodeStart":216,"sourceCodeEnd":252,"githubUrl":"https://github.com/denoland/deno/blob/9ad36f7a2cce60488e6ec52283efb32efddaf93a/cli/tsc/native.rs#L216-L252","documentation":"`deno check` type-checks with a native (Go) tsc binary that Deno downloads on demand and caches under DENO_DIR (ensure_native_tsc, cli/tsc/native.rs:78). run_native_tsc spawns that cached binary with `--project <tsconfig> --noEmit --pretty false --diagnostics`; this error (native.rs:234) wraps an OS-level spawn failure — the process never started. It is distinct from TypeScript diagnostics, which are parsed separately.","triggerScenarios":"`deno check` when the cached tsc binary was deleted, moved, or quarantined by antivirus between the exists() check and the spawn; exec permission lost on the binary; out-of-memory / fork limits at spawn time; arch-mismatched binary after an OS migration.","commonSituations":"Antivirus/EDR removing little-known downloaded binaries; `deno clean` or manual DENO_DIR surgery racing a check; containers with low PID/memory limits; shared caches across machines.","solutions":["Delete the cached native tsc so it re-downloads: remove the tsc cache directory under the DENO_DIR location printed by `deno info`, then re-run `deno check`.","Check exec permission and disk space on the cached binary path shown in Deno's cache.","If security software quarantined it, allowlist the DENO_DIR location.","Persist after a clean re-download? Report with the spawn error suffix ({e} names the io::Error kind)."],"exampleFix":"# before\n$ deno check .\nerror: failed to run native tsc: No such file or directory (os error 2)\n\n# after — purge the broken cache and re-run\ndeno_dir=$(deno info 2>/dev/null | sed -n 's/^DENO_DIR: //p')\nrm -rf \"$deno_dir/tsc\" 2>/dev/null || rm -rf \"${DENO_DIR:-$HOME/.cache/deno}/tsc\"\ndeno check .","handlingStrategy":"validation","validationCode":"# Verify the cached native tsc binary exists and is executable before `deno check`\ndeno_dir=$(deno info 2>/dev/null | sed -n 's/^DENO_DIR: //p')\nbin=$(find \"${deno_dir:-${DENO_DIR:-$HOME/.cache/deno}}\" -type f -name 'tsc' -perm -u+x 2>/dev/null | head -1)\n[ -n \"$bin\" ] || echo 'native tsc missing/non-executable — expect spawn failure'; deno check .","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Allowlist the DENO_DIR cache in antivirus/EDR so the downloaded tsc binary is not quarantined.","After OS/arch migrations or deno clean, run a trivial `deno check` early to re-download the toolchain.","Keep disk space and process limits healthy — spawn-time ENOMEM/EPERM surfaces as this same error."],"tags":["check","tsc","cache","spawn"],"backgroundTag":"cached-binary-spawn-failed","analyzedSha":"9ad36f7a2cce60488e6ec52283efb32efddaf93a","analyzedAt":"2026-08-20T13:07:44.778Z","contentChangedAt":"2026-08-20T13:07:44.778Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}