{"record":{"id":"5ab5a4a4b115a93b","repo":"denoland/deno","slug":"task-not-found","errorCode":null,"errorMessage":"Task not found: {}","messagePattern":"Task not found: (.+?)","errorType":"exception","errorClass":"anyhow::Error","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/89f33cbef296a2b287f323d42de54c871fa69c77/cli/tools/task.rs#L416-L452","documentation":"`deno task` resolves the task graph by walking each matched task and its declared dependencies topologically (`sort_tasks_topo`). If a visited name — the requested task or any name listed in a task's `dependencies` — is not defined in the member's or root's task config, `TaskError::NotFound` surfaces here. Under `deno task --run` it is a returned error; otherwise it is logged, available tasks are printed, and the run exits 1.","triggerScenarios":"A task's `dependencies` array references an undefined task name (typo, renamed task, task defined only in a different member), or a matched task name does not exist in the member or root config being walked.","commonSituations":"Refactoring deno.json task names without updating dependents; workspace members expecting root tasks that were moved; typos in dependency lists.","solutions":["Run `deno task` with no arguments to list the defined task names","Fix the typo or add the missing task definition under `\"tasks\"` in deno.json (member or workspace root)","Remember lookup order: the member config first, then the root config — the dependency must exist in one of them","Avoid `deno task --run` for optional tasks; it turns NotFound into a hard error"],"exampleFix":"// before — deno.json\n{\n  \"tasks\": {\n    \"dev\": { \"dependencies\": [\"serve\"] }\n  }\n}\n// 'serve' is not defined\n// after\n{\n  \"tasks\": {\n    \"dev\": { \"dependencies\": [\"server\"] },\n    \"server\": \"deno run --watch server.ts\"\n  }\n}","handlingStrategy":"validation","validationCode":"# fail fast if any task dependency is undefined (deno.json)\ndeno eval 'const t = JSON.parse(Deno.readTextFileSync(\"deno.json\").replace(/^\\/\\/.*$/gm, \"\")).tasks ?? {};\nconst known = new Set(Object.keys(t));\nfor (const [name, def] of Object.entries(t)) {\n  for (const d of def.dependencies ?? []) {\n    if (!known.has(d)) { console.error(`task ${name} -> undefined dependency ${d}`); Deno.exit(1); }\n  }\n}'","typeGuard":null,"tryCatchPattern":null,"preventionTips":["When renaming a task, grep the whole workspace for old references including `dependencies` arrays","Run `deno task` (bare) after task-config edits to confirm the graph resolves","Remember dependencies resolve member-first then root — define shared tasks in the root config"],"tags":["task","deno-json","workspace","config"],"backgroundTag":null,"analyzedSha":"89f33cbef296a2b287f323d42de54c871fa69c77","analyzedAt":"2026-08-16T07:54:21.310Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}