denoland/deno · error

When using DENO_INTERNAL_FAST_CHECK_OVERWRITE, the git repo

Error message

When using DENO_INTERNAL_FAST_CHECK_OVERWRITE, the git repo must be in a clean state.

What it means

`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.

Source

Thrown at cli/tools/publish/mod.rs:439

      log::info!(
        concat!(
          "{} Publishing a library with slow types is not recommended. ",
          "This may lead to poor type checking performance for users of ",
          "your package, may affect the quality of automatic documentation ",
          "generation, and your package will not be shipped with a .d.ts ",
          "file for Node.js users."
        ),
        colors::yellow("Warning"),
      );
      Ok(Arc::new(graph))
    } else if std::env::var("DENO_INTERNAL_FAST_CHECK_OVERWRITE").as_deref()
      == Ok("1")
    {
      if check_if_git_repo_dirty(self.cli_options.initial_cwd())
        .await
        .is_some()
      {
        bail!(
          "When using DENO_INTERNAL_FAST_CHECK_OVERWRITE, the git repo must be in a clean state."
        );
      }

      for module in graph.modules() {
        if module.specifier().scheme() != "file" {
          continue;
        }
        let Some(js) = module.js() else {
          continue;
        };
        if let Some(module) = js.fast_check_module() {
          std::fs::write(
            js.specifier.to_file_path().unwrap(),
            module.source.as_ref(),
          )?;
        }
      }

View on GitHub (pinned to f7822238ca)

Solutions

  1. Commit or stash local changes (`git stash` or commit), then re-run with the env var set.
  2. If you did not intend the destructive rewrite, unset the variable: `unset DENO_INTERNAL_FAST_CHECK_OVERWRITE`.

Example fix

# before
git status --porcelain  # non-empty
DENO_INTERNAL_FAST_CHECK_OVERWRITE=1 deno publish --dry-run   # error
# after
git stash && DENO_INTERNAL_FAST_CHECK_OVERWRITE=1 deno publish --dry-run
Defensive patterns

Strategy: validation

Validate before calling

#!/usr/bin/env bash
[ -n "$(git status --porcelain)" ] && { echo "repo must be clean before FAST_CHECK_OVERWRITE" >&2; exit 1; }
DENO_INTERNAL_FAST_CHECK_OVERWRITE=1 deno publish --dry-run

Prevention

When it happens

Trigger: Setting `DENO_INTERNAL_FAST_CHECK_OVERWRITE=1` while `check_if_git_repo_dirty` reports uncommitted changes in the repo of the initial cwd.

Common situations: Deno contributors/maintainers regenerating fast-check snapshots or expectations without committing prior edits first.

Related errors


AI-assisted analysis of denoland/deno@f7822238ca (2026-08-20). Data as JSON: /api/errors/c7cdc7da0b7e62f8. Report an issue: GitHub.