denoland/deno · error

Type checking failed.

Error message

Type checking failed.

What it means

`deno check` failed because every requested root was a missing local file: the module graph had diagnostics (e.g. 'Module not found') and no existing files remained for tsc to check. Deno prints the graph diagnostics first, then exits with this error so the failure is reflected in the exit code.

Source

Thrown at cli/tools/check.rs:289

  // it under `.deno/remote/`. Pin tsc to those mirror files too, so a remote
  // entrypoint is checked as itself rather than triggering the whole-project
  // `include` fallback below (which would check unrelated files, or nothing).
  files.extend(remote_root_mirror_files(&project_root, &roots));

  // Render each root relative to the invocation directory, matching deno's own
  // `Check <specifier>` output.
  let current_dir =
    deno_path_util::url_from_directory_path(cli_options.initial_cwd())
      .map_err(|e| deno_core::anyhow::anyhow!("{e}"))?;

  // Every requested root was a missing (non-existent) local entrypoint: there's
  // nothing for tsc to check, so report deno's graph diagnostics for them
  // directly instead of falling back to the base config's project-wide
  // `include` (which would check unrelated files).
  if files.is_empty() && root_diagnostics.has_diagnostic() {
    log_check_roots(&roots, &current_dir);
    log::error!("{}\n", root_diagnostics);
    return Err(deno_core::anyhow::anyhow!("Type checking failed."));
  }

  // Holds the per-file config's temp file open until tsc has run (dropping it
  // deletes the file).
  let _check_tsconfig_guard;
  let tsconfig_path = if files.is_empty() {
    base_tsconfig
  } else {
    // `deno check <files>` checks only the named files (and their imports), not
    // the whole project. The generated `tsconfig.json` keeps an open `include`
    // (so bundlers can consume its resolver mappings), so write a per-file
    // config that extends it (by absolute path) and pins `files` - `files`/
    // `include` are not inherited through `extends`, so only these files are
    // type-checked while compilerOptions/paths still apply. `include: []`
    // nullifies the base's open `include` (tsc unions `files` with an inherited
    // `include`, which would otherwise re-add the whole project).
    //
    // `files`/`include` are not inherited through `extends`, so the base config's

View on GitHub (pinned to 9ad36f7a2c)

Solutions

  1. Fix the paths passed to `deno check` — the printed graph diagnostic names each missing module
  2. If the files are generated, generate them before the check step (e.g. `deno task codegen && deno check`)
  3. Verify glob roots in CI match the actual layout rather than ignoring the error

Example fix

# before
deno check src/typo.ts

# after
deno check src/types.ts
Defensive patterns

Strategy: validation

Validate before calling

// Pre-check every root before invoking deno check
const paths = ["src/types.ts"];
for (const p of paths) {
  await Deno.stat(p); // throws a clear error if a root is missing
}

Prevention

When it happens

Trigger: `deno check typo.ts` where the file does not exist; every passed path or glob matches nothing on disk, so `files` is empty while `root_diagnostics` has entries.

Common situations: Typos in file paths; files moved or renamed; CI checkouts missing generated files; globs that match nothing.

Related errors


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