denoland/deno · error

{:#}

Error message

{:#}

What it means

Inside the publish-oriented lint pass, Deno builds a module graph for the workspace and awaits a shared future. If graph construction fails (unresolved specifier, missing file, unreadable module), the error is re-wrapped as anyhow!("{:#}", err), which prints the flattened error chain. The real cause is whatever module-graph failure the original error carried — this message is only the wrapper.

Source

Thrown at cli/tools/lint/mod.rs:478

      );
    }

    let workspace_module_graph_future =
      self.workspace_module_graph.as_ref().unwrap().clone();
    let maybe_publish_config = member_dir.maybe_package_config();
    let publish_config = maybe_publish_config?;

    let has_error = self.has_error.clone();
    let reporter_lock = self.reporter_lock.clone();
    let linter = linter.clone();
    let path_urls = paths
      .iter()
      .filter_map(|p| ModuleSpecifier::from_file_path(p).ok())
      .collect::<HashSet<_>>();
    let fut = async move {
      let graph = workspace_module_graph_future
        .await
        .map_err(|err| anyhow!("{:#}", err))?;
      let export_urls =
        publish_config.config_file.resolve_export_value_urls()?;
      if !export_urls.iter().any(|url| path_urls.contains(url)) {
        return Ok(()); // entrypoint is not specified, so skip
      }
      let diagnostics = linter.lint_package(&graph, &export_urls);
      if !diagnostics.is_empty() {
        has_error.raise();
        let mut reporter = reporter_lock.lock();
        for diagnostic in &diagnostics {
          reporter.visit_diagnostic(diagnostic);
        }
      }
      Ok(())
    }
    .boxed_local();
    Some(fut)
  }

View on GitHub (pinned to 89f33cbef2)

Solutions

  1. Read the text after 'Error:' — it names the underlying graph failure (specifier/path); fix that first
  2. Run `deno check` on the exported entrypoints to surface the same graph breakage directly
  3. Ensure every file reachable from exports exists and its imports are declared
  4. Run `deno publish --dry-run` locally before tagging a release

Example fix

// deno.json exports "./mod.ts" but mod.ts imports "./missing.ts"
// before: export { helper } from "./missing.ts";
// after: create missing.ts, or remove/repoint the import
Defensive patterns

Strategy: try-catch

Validate before calling

# surface graph breakage with better context before publishing
deno check ./mod.ts && deno publish --dry-run

Try / catch

# CI step: catch the failure and point at the underlying cause
- name: publish preflight
  run: |
    deno publish --dry-run || {
      echo '::error::module graph failure — the real cause is the Error: line above'
      exit 1
    }

Prevention

When it happens

Trigger: `deno publish` (or linting a package with a publish config) where the module graph cannot be built: an exported file imports a specifier that cannot be resolved, a dependency is missing from config, or a reachable file was deleted/moved.

Common situations: Export maps pointing at files excluded from publishing; imports of packages absent from deno.json; moving files without updating exports; stale caches after dependency changes.

Related errors


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