denoland/deno · error

Type checking failed.

Error message

Type checking failed.

What it means

Native check short-circuit: every requested root was a missing (non-existent) local file, so there is nothing for tsc to check; deno's graph diagnostics for those roots are logged (log::error above), and the run exits with this error to report failure (cli/tools/check.rs:282-290). The real information - which paths are missing - is in the diagnostics printed before it.

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 89f33cbef2)

Solutions

  1. Look at the diagnostics printed above the error - they name each missing specifier
  2. Fix the path/typo, or generate/create the file before checking (run codegen first)
  3. Clean stale references out of check scripts when modules are renamed or deleted

Example fix

# before
deno check src/missng.ts   # 'Type checking failed.' + TS2307-style missing-module diagnostics
# after
deno check src/missing.ts
Defensive patterns

Strategy: validation

Validate before calling

#!/usr/bin/env bash
# Existence-check every explicit root before native check
for f in "$@"; do
  [ -e "$f" ] || { echo "no such file: $f"; exit 2; }
done
deno check "$@"

Try / catch

# Distinguish 'missing file' failures from real type errors in CI
deno check src/**/*.ts 2>&1 | tee check.log; rc=${PIPESTATUS[0]}
[ $rc -eq 0 ] || grep -q 'Cannot find module' check.log && echo 'missing-module path in roots - check file names/codegen'
exit $rc

Prevention

When it happens

Trigger: 'deno check typo.ts' / 'deno check src/missng.ts' where the file does not exist; a glob expanding to nothing with an explicitly-named missing file; build scripts referencing moved/deleted files.

Common situations: Typos in CI check commands; renamed modules with stale references in scripts; files not yet generated (codegen step not run before deno check).

Related errors


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