{"record":{"id":"c7cdc7da0b7e62f8","repo":"denoland/deno","slug":"when-using-deno-internal-fast-check-overwrite-the","errorCode":null,"errorMessage":"When using DENO_INTERNAL_FAST_CHECK_OVERWRITE, the git repo must be in a clean state.","messagePattern":"When using DENO_INTERNAL_FAST_CHECK_OVERWRITE, the git repo must be in a clean state\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/tools/publish/mod.rs","lineNumber":439,"sourceCode":"      log::info!(\n        concat!(\n          \"{} Publishing a library with slow types is not recommended. \",\n          \"This may lead to poor type checking performance for users of \",\n          \"your package, may affect the quality of automatic documentation \",\n          \"generation, and your package will not be shipped with a .d.ts \",\n          \"file for Node.js users.\"\n        ),\n        colors::yellow(\"Warning\"),\n      );\n      Ok(Arc::new(graph))\n    } else if std::env::var(\"DENO_INTERNAL_FAST_CHECK_OVERWRITE\").as_deref()\n      == Ok(\"1\")\n    {\n      if check_if_git_repo_dirty(self.cli_options.initial_cwd())\n        .await\n        .is_some()\n      {\n        bail!(\n          \"When using DENO_INTERNAL_FAST_CHECK_OVERWRITE, the git repo must be in a clean state.\"\n        );\n      }\n\n      for module in graph.modules() {\n        if module.specifier().scheme() != \"file\" {\n          continue;\n        }\n        let Some(js) = module.js() else {\n          continue;\n        };\n        if let Some(module) = js.fast_check_module() {\n          std::fs::write(\n            js.specifier.to_file_path().unwrap(),\n            module.source.as_ref(),\n          )?;\n        }\n      }","sourceCodeStart":421,"sourceCodeEnd":457,"githubUrl":"https://github.com/denoland/deno/blob/f7822238cab635a3a19f99f493f675fa81a7f9d8/cli/tools/publish/mod.rs#L421-L457","documentation":"`DENO_INTERNAL_FAST_CHECK_OVERWRITE=1` is a Deno-internal switch that makes publish overwrite your source files with their fast-check (public API) transformed output — a destructive operation. So the rewrite can always be undone with git, publish first demands the repo be clean and bails otherwise.","triggerScenarios":"Setting `DENO_INTERNAL_FAST_CHECK_OVERWRITE=1` while `check_if_git_repo_dirty` reports uncommitted changes in the repo of the initial cwd.","commonSituations":"Deno contributors/maintainers regenerating fast-check snapshots or expectations without committing prior edits first.","solutions":["Commit or stash local changes (`git stash` or commit), then re-run with the env var set.","If you did not intend the destructive rewrite, unset the variable: `unset DENO_INTERNAL_FAST_CHECK_OVERWRITE`."],"exampleFix":"# before\ngit status --porcelain  # non-empty\nDENO_INTERNAL_FAST_CHECK_OVERWRITE=1 deno publish --dry-run   # error\n# after\ngit stash && DENO_INTERNAL_FAST_CHECK_OVERWRITE=1 deno publish --dry-run","handlingStrategy":"validation","validationCode":"#!/usr/bin/env bash\n[ -n \"$(git status --porcelain)\" ] && { echo \"repo must be clean before FAST_CHECK_OVERWRITE\" >&2; exit 1; }\nDENO_INTERNAL_FAST_CHECK_OVERWRITE=1 deno publish --dry-run","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Commit or stash before enabling DENO_INTERNAL_FAST_CHECK_OVERWRITE — it rewrites sources and needs git as the undo path.","Keep the variable scoped to the single invocation (inline env assignment), never exported globally.","Run it only in throwaway/dedicated CI jobs that diff the rewrite afterwards."],"tags":["publish","internal","fast-check","git"],"backgroundTag":"uncommitted-changes","analyzedSha":"f7822238cab635a3a19f99f493f675fa81a7f9d8","analyzedAt":"2026-08-20T13:07:44.778Z","contentChangedAt":"2026-08-20T13:07:44.778Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}