{"record":{"id":"514822e1e353a3fe","repo":"go-task/task","slug":"task-invalid-run-s","errorCode":null,"errorMessage":"task: invalid run \"%s\"","messagePattern":"task: invalid run \"(.+?)\"","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"hash.go","lineNumber":22,"sourceCode":"\t\"cmp\"\n\t\"fmt\"\n\n\t\"github.com/go-task/task/v3/internal/hash\"\n\t\"github.com/go-task/task/v3/taskfile/ast\"\n)\n\nfunc (e *Executor) GetHash(t *ast.Task) (string, error) {\n\tr := cmp.Or(t.Run, e.Taskfile.Run)\n\tvar h hash.HashFunc\n\tswitch r {\n\tcase \"always\":\n\t\th = hash.Empty\n\tcase \"once\":\n\t\th = hash.Name\n\tcase \"when_changed\":\n\t\th = hash.Hash\n\tdefault:\n\t\treturn \"\", fmt.Errorf(`task: invalid run \"%s\"`, r)\n\t}\n\treturn h(t)\n}\n","sourceCodeStart":4,"sourceCodeEnd":26,"githubUrl":"https://github.com/go-task/task/blob/385e5ad92af02877b6d7cf9dcc963b5ed916e70a/hash.go#L4-L26","documentation":"Task validates the `run:` attribute of a task against its known execution modes (e.g. always, once, when_changed) inside GetHash, which maps the mode to a hashing strategy. An unrecognized value aborts with this error before the task runs. It is a strict enum-validation error for the Taskfile's `run` field.","triggerScenarios":"A task declares `run: <value>` with a string that is not one of the supported modes, and startExecution calls GetHash to pick the status-hash strategy.","commonSituations":"Typo like `run: onc` or `run: once_per_taskfile`, copying modes from other tools (e.g. `run: always` misspelled as `run: alway`), or YAML quoting issues leaving an unexpected value.","solutions":["Set `run:` to a supported value: always, once, or when_changed","Check the Taskfile schema/docs for your Task version — older versions support fewer modes","Validate the Taskfile with `task --list` or the JSON schema in your editor to catch typos"],"exampleFix":"# before\nmytask:\n  run: onc\n  cmds: [echo hi]\n# after\nmytask:\n  run: once\n  cmds: [echo hi]","handlingStrategy":"validation","validationCode":"var validRunModes = map[string]bool{\"always\":true,\"once\":true,\"when_changed\":true}\nif r := taskDef.Run; r != \"\" && !validRunModes[r] {\n  return fmt.Errorf(\"invalid run mode %q in task %s\", r, taskDef.Name)\n}","typeGuard":null,"tryCatchPattern":"err := t.Run(ctx)\nif err != nil && strings.HasPrefix(err.Error(), `task: invalid run`) {\n  // fix or strip the run: attribute before retrying\n}","preventionTips":["Validate Taskfiles against the official JSON schema in your editor/CI","Only use documented run values: always, once, when_changed","Lint Taskfiles in CI to catch typos before execution"],"tags":["taskfile","configuration","enum-validation"],"backgroundTag":"invalid-enum-value","analyzedSha":"385e5ad92af02877b6d7cf9dcc963b5ed916e70a","analyzedAt":"2026-09-05T09:01:05.226Z","contentChangedAt":"2026-09-05T09:01:05.226Z","schemaVersion":2},"datasetVersion":"2026-09-12T12:17:11.808Z"}