{"record":{"id":"eed8d2d40c0dc05c","repo":"hashicorp/nomad","slug":"task-not-running","errorCode":null,"errorMessage":"Task not running","messagePattern":"Task not running","errorType":"exception","errorClass":"ErrTaskNotRunning","httpStatus":null,"severity":"error","filePath":"client/allocrunner/taskrunner/errors/errors.go","lineNumber":14,"sourceCode":"// Copyright IBM Corp. 2015, 2026\n// SPDX-License-Identifier: BUSL-1.1\n\npackage errors\n\nimport (\n\t\"errors\"\n\n\t\"github.com/hashicorp/nomad/nomad/structs\"\n)\n\n// ErrTaskNotRunning is returned when the underlying task is not currently\n// running. It's defined here to avoid import cycles.\nvar ErrTaskNotRunning = errors.New(\"Task not running\")\n\n// NewHookError contains an underlying err and a pre-formatted task event.\nfunc NewHookError(err error, taskEvent *structs.TaskEvent) error {\n\treturn &HookError{\n\t\tErr:       err,\n\t\tTaskEvent: taskEvent,\n\t}\n}\n\ntype HookError struct {\n\tTaskEvent *structs.TaskEvent\n\tErr       error\n}\n\nfunc (h *HookError) Error() string {\n\treturn h.Err.Error()\n}\n","sourceCodeStart":1,"sourceCodeEnd":32,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/client/allocrunner/taskrunner/errors/errors.go#L1-L32","documentation":"Sentinel ErrTaskNotRunning: returned when an operation (e.g. exec, kill, signal) targets a task that is not in the running state. Defined in the taskrunner errors package to avoid import cycles; callers like alloc_runner treat it as benign when stopping tasks.","triggerScenarios":"Thrown at client/allocrunner/taskrunner/errors/errors.go:14 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Wait for the task to reach 'running' before issuing exec/signal operations","Treat it as a no-op when the intent was to stop or kill the task","Check task logs/events for why the task exited"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"482b49bf1aec006f089bcfc7e632d8f6ac303e5e","analyzedAt":"2026-09-04T07:54:14.808Z","contentChangedAt":"2026-09-04T07:54:14.808Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}