{"record":{"id":"48b4aa37daf78a0f","repo":"denoland/deno","slug":"expected-file-file-to-exist","errorCode":null,"errorMessage":"expected file \"{file}\" to exist","messagePattern":"expected file \"(.+?)\" to exist","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"cli/build.rs","lineNumber":223,"sourceCode":"    let relative_str = relative.to_string_lossy().replace('\\\\', \"/\");\n    generated.push_str(&format!(\n      \"      maybe_compressed_static_asset!(\\\"{}\\\", false),\\n\",\n      relative_str\n    ));\n  }\n\n  generated.push_str(\"    ]\\n\");\n  generated.push_str(\"  };\\n\");\n  generated.push_str(\"}\\n\");\n\n  std::fs::write(out_dir.join(\"node_types.rs\"), generated).unwrap();\n}\n\nfn compress_source(out_dir: &Path, file: &str) {\n  #[allow(clippy::disallowed_methods, reason = \"build code\")]\n  let path = Path::new(file)\n    .canonicalize()\n    .unwrap_or_else(|_| panic!(\"expected file \\\"{file}\\\" to exist\"));\n  let contents = std::fs::read(&path).unwrap();\n\n  println!(\"cargo:rerun-if-changed={}\", path.display());\n\n  let compressed = zstd::bulk::compress(&contents, 19).unwrap();\n  let mut out = out_dir.join(file.trim_start_matches(\"../\"));\n  let mut ext = out\n    .extension()\n    .map(|s| s.to_string_lossy())\n    .unwrap_or_default()\n    .into_owned();\n  ext.push_str(\".zstd\");\n  out.set_extension(ext);\n  std::fs::create_dir_all(out.parent().unwrap()).unwrap();\n  let mut file = std::fs::OpenOptions::new()\n    .create(true)\n    .truncate(true)\n    .write(true)","sourceCodeStart":205,"sourceCodeEnd":241,"githubUrl":"https://github.com/denoland/deno/blob/9ad36f7a2cce60488e6ec52283efb32efddaf93a/cli/build.rs#L205-L241","documentation":"Deno's CLI build script zstd-compresses checked-in JS sources (cli/tsc/99_main_compiler.js, 97_ts_host.js, 98_lsp.js, 00_typescript.js, and the tsc/dts .d.ts set) for release builds. compress_source (cli/build.rs:219-249) canonicalizes each listed path and panics 'expected file ... to exist' when canonicalize fails, i.e. the file is registered for compression but missing from the checkout. Compression only runs when !cfg!(debug_assertions) (build.rs:190), so debug builds pass while release builds and cargo publish verification fail.","triggerScenarios":"cargo build --release or cargo publish with one of cli/tsc/*.js or a tsc/dts/*.d.ts absent; partial or shallow clones; stale OUT_DIR file lists after files were added/renamed; a file removed by tooling or a bad .gitignore rule.","commonSituations":"Fresh machines where the generated/checked-out tsc assets are incomplete; branch switches that change the .d.ts set while the build cache keeps an old manifest; case-insensitive filesystems mis-checking-out differing capitalizations.","solutions":["Restore the exact path from the panic text: git status --short cli/tsc, then git checkout -- cli/tsc (or rerun the step that generates the tsc bundle).","Clear the build-script output cache so the file list is recomputed: cargo clean -p deno or remove target/**/build/deno-*/.","Verify the file exists (ls cli/tsc/<file>) before rebuilding; if it is genuinely untracked, regenerate or re-checkout rather than touching build.rs."],"exampleFix":"# before\ncargo build --release\n# panic: expected file \"../tsc/00_typescript.js\" to exist\n\n# after\ngit checkout -- cli/tsc\ncargo build --release","handlingStrategy":"validation","validationCode":"# preflight before a release build\nfor f in cli/tsc/00_typescript.js cli/tsc/97_ts_host.js \\\n         cli/tsc/98_lsp.js cli/tsc/99_main_compiler.js; do\n  test -f \"$f\" || { echo \"missing $f — run: git checkout -- cli/tsc\"; exit 1; }\ndone\ncompgen -G 'cli/tsc/dts/*.d.ts' > /dev/null || { echo 'missing dts files'; exit 1; }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Verify cli/tsc assets exist before release builds — the panic only fires without debug assertions","After branch switches that change the .d.ts set, cargo clean -p deno to refresh the build-script manifest","Avoid clones that skip or shallow-filter cli/tsc; do not gitignore generated tsc bundles"],"tags":["deno","build","cargo","build-script","release-build"],"backgroundTag":"missing-build-artifact","analyzedSha":"9ad36f7a2cce60488e6ec52283efb32efddaf93a","analyzedAt":"2026-08-20T13:07:44.778Z","schemaVersion":2},"datasetVersion":"2026-08-31T09:17:48.483Z"}