{"record":{"id":"7ba82f6f9a4c721f","repo":"denoland/deno","slug":"no-matching-module-graph-roots-found","errorCode":null,"errorMessage":"No matching module graph roots found.","messagePattern":"No matching module graph roots found\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/tools/installer/local.rs","lineNumber":325,"sourceCode":"    let roots: Vec<_> = roots\n      .into_iter()\n      .filter(|u| {\n        let Ok(path) = u.to_file_path() else {\n          return true;\n        };\n        if let Some(root) = &deno_dir_root\n          && path.starts_with(root)\n        {\n          return false;\n        }\n        let rel = path.strip_prefix(&project_root).unwrap_or(&path);\n        !rel.components().any(|c| {\n          matches!(c.as_os_str().to_str(), Some(\"node_modules\") | Some(\".deno\"))\n        })\n      })\n      .collect();\n    if has_explicit_roots && roots.is_empty() {\n      bail!(\"No matching module graph roots found.\");\n    }\n\n    // Build the graph error-tolerantly: `create_graph_with_options` populates\n    // the graph and records unresolved modules as error entries without failing\n    // the whole build (unlike `check_specifiers`, which validates and discards\n    // everything on the first missing module). A real project always has some\n    // broken file (dead example scripts, etc.); we want every specifier that\n    // *did* resolve regardless.\n    let graph_creator = factory.module_graph_creator().await?;\n    // Silence warn-level diagnostics during this discovery build. It's an\n    // internal step (not the user's `deno check`), and the graph the user\n    // installed was already validated by `deno install` — re-emitting e.g.\n    // \"workspace member ... was not used\" warnings here is just noise.\n    let prev_log_level = log::max_level();\n    log::set_max_level(log::LevelFilter::Error);\n    let graph_result = graph_creator\n      .create_graph_with_options(crate::graph_util::CreateGraphOptions {\n        graph_kind: deno_graph::GraphKind::All,","sourceCodeStart":307,"sourceCodeEnd":343,"githubUrl":"https://github.com/denoland/deno/blob/9ad36f7a2cce60488e6ec52283efb32efddaf93a/cli/tools/installer/local.rs#L307-L343","documentation":"`deno sync-types` (also invoked internally by `deno check`/setup for stock tsc) builds a module graph over explicit root patterns you passed to discover external specifiers. Roots that live under the DENO_DIR cache, or under node_modules/.deno relative to the project root, are filtered out to avoid graphing tens of thousands of dependency files. If you passed explicit roots and every one of them was filtered away, it bails with this message.","triggerScenarios":"`deno sync-types <args>` where all matched files are inside node_modules/, a generated .deno/ dir, or DENO_DIR (e.g. `deno sync-types node_modules/...`, or a glob like `./vendor/**` that only matches filtered trees, or a project directory that itself sits under a path named node_modules).","commonSituations":"Pointing sync-types at installed dependencies instead of your own source; running from inside node_modules; overly broad globs whose only matches are generated/installed trees.","solutions":["Point the roots at your own source files: `deno sync-types src/`","If the project really lives under a directory named node_modules, move it or pass roots as file paths outside that tree","Run `deno sync-types` with no roots to use '.' — the default project-wide discovery"],"exampleFix":"# before\ndeno sync-types node_modules/left-pad   # No matching module graph roots found.\n\n# after\ndeno sync-types src/","handlingStrategy":"validation","validationCode":"# pass roots that live in your own source tree:\ndeno sync-types src/\n# sanity check before scripting:\nls src/*.ts >/dev/null || echo 'no project sources under src/'","typeGuard":null,"tryCatchPattern":"Catch 'No matching module graph roots found'; retry `deno sync-types` with no root arguments (defaults to '.' over the project) — that path does not require the filter to keep anything.","preventionTips":["Never point sync-types at node_modules/, .deno/, or DENO_DIR-managed trees","Keep projects out of directories named node_modules","Prefer the no-roots form `deno sync-types` for whole-project discovery"],"tags":["sync-types","module-graph","roots","node-modules","cli"],"backgroundTag":"no-matching-input-paths","analyzedSha":"9ad36f7a2cce60488e6ec52283efb32efddaf93a","analyzedAt":"2026-08-20T13:07:44.778Z","contentChangedAt":"2026-08-20T13:07:44.778Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}