{"record":{"id":"5ab5a4a4b115a93b","repo":"denoland/deno","slug":"task-not-found","errorCode":null,"errorMessage":"Task not found: {}","messagePattern":"Task not found: (.+?)","errorType":"exception","errorClass":"AnyError","httpStatus":null,"severity":"error","filePath":"cli/tools/task.rs","lineNumber":434,"sourceCode":"\nimpl<'a> TaskRunner<'a> {\n  /// Topologically sort all matched tasks across the given packages into a\n  /// single flat list, then run them through `run_tasks_in_parallel` so tasks\n  /// from sibling packages execute concurrently.\n  pub async fn run_all_tasks(\n    &self,\n    packages: &'a [PackageTaskInfo],\n    task_name: &str,\n    kill_signal: &KillSignal,\n    argv: &'a [String],\n  ) -> Result<i32, deno_core::anyhow::Error> {\n    let mut sorted: Vec<ResolvedTask<'a>> = Vec::new();\n    for pkg in packages {\n      if let Err(err) = sort_tasks_topo(pkg, &mut sorted) {\n        return match err {\n          TaskError::NotFound(name) => {\n            if self.task_flags.is_run {\n              return Err(anyhow!(\"Task not found: {}\", name));\n            }\n            log::error!(\"Task not found: {}\", name);\n            if log::log_enabled!(log::Level::Error) {\n              self.print_available_tasks(&pkg.tasks_config)?;\n            }\n            Ok(1)\n          }\n          TaskError::TaskDepCycle { path } => {\n            log::error!(\"Task cycle detected: {}\", path.join(\" -> \"));\n            Ok(1)\n          }\n        };\n      }\n    }\n\n    if sorted.is_empty() {\n      if self.task_flags.is_run {\n        return Err(anyhow!(\"Task not found: {}\", task_name));","sourceCodeStart":416,"sourceCodeEnd":452,"githubUrl":"https://github.com/denoland/deno/blob/9ad36f7a2cce60488e6ec52283efb32efddaf93a/cli/tools/task.rs#L416-L452","documentation":"While topologically sorting matched tasks (sort_tasks_topo in cli/tools/task.rs), Deno resolves every task's `dependencies` array; a dependency naming a task that exists in no workspace package yields TaskError::NotFound. The name in the message is the missing *dependency*, not the task you asked for. When invoked via `deno run <name>` (task_flags.is_run, set in cli/lib.rs:414) it becomes a hard error; under `deno task` it is logged with the list of available tasks and exit code 1.","triggerScenarios":"deno task build (or deno run build) where build has \"dependencies\": [\"clean\"] and no task named clean exists in any member's deno.json tasks or package.json scripts; a workspace member with the task was removed or renamed.","commonSituations":"Renaming a task without updating dependents; typos in dependency arrays; copy-pasting tasks from another repo that reference repo-local tasks; workspace restructuring that moved a task to a non-member directory.","solutions":["Run `deno task` with no arguments to list the task names that actually exist.","Fix the deno.json `dependencies` array of the task that references the missing name — the {name} in the message tells you exactly which entry is dangling.","If the dependency is optional, either remove it from the list or define a no-op task (\"clean\": \"echo skip\") for it."],"exampleFix":"// deno.json — before\n{\n  \"tasks\": {\n    \"build\": { \"dependencies\": [\"clean\", \"bundle\"] },\n    \"bundle\": \"esbuild src/index.ts --bundle\"\n  }\n}\n\n// after — define the missing dependency\n{\n  \"tasks\": {\n    \"build\": { \"dependencies\": [\"clean\", \"bundle\"] },\n    \"clean\": \"rm -rf dist\",\n    \"bundle\": \"esbuild src/index.ts --bundle\"\n  }\n}","handlingStrategy":"validation","validationCode":"// Verify every dependency referenced in deno.json exists before running tasks\nimport denoJson from \"./deno.json\" with { type: \"json\" };\nconst tasks: Record<string, unknown> = denoJson.tasks ?? {};\nconst names = new Set(Object.keys(tasks));\nfor (const [name, def] of Object.entries(tasks)) {\n  const deps = (def as { dependencies?: string[] })?.dependencies ?? [];\n  for (const dep of deps) {\n    if (!names.has(dep)) throw new Error(`task \"${name}\" depends on missing task \"${dep}\"`);\n  }\n}","typeGuard":"const taskExists = (name: string, tasks: Record<string, unknown>) =>\n  Object.hasOwn(tasks, name);","tryCatchPattern":null,"preventionTips":["Run bare `deno task` after renaming or deleting tasks to catch dangling references early.","Grep the workspace for old task names whenever a name changes.","Treat the `dependencies` array like an API surface: update every reference or add a no-op shim task."],"tags":["task","deno-json","dependencies","cli"],"backgroundTag":"task-not-found","analyzedSha":"9ad36f7a2cce60488e6ec52283efb32efddaf93a","analyzedAt":"2026-08-20T13:07:44.778Z","contentChangedAt":"2026-08-20T13:07:44.778Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}