{"record":{"id":"4555cd14c0347234","repo":"hashicorp/nomad","slug":"invalid-event-hook-given","errorCode":null,"errorMessage":"Invalid event hook given","messagePattern":"Invalid event hook given","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"client/allocrunner/taskrunner/template/template.go","lineNumber":158,"sourceCode":"\n\tLogger hclog.Logger\n\n\t// RenderFunc allows custom rendering of templated data, and overrides the\n\t// Nomad custom RenderFunc used for sandboxing. This is currently used by\n\t// the secrets block to hold all templated data in memory.\n\tRenderFunc renderer.Renderer\n}\n\n// Validate validates the configuration.\nfunc (c *TaskTemplateManagerConfig) Validate() error {\n\tif c == nil {\n\t\treturn fmt.Errorf(\"Nil config passed\")\n\t} else if c.UnblockCh == nil {\n\t\treturn fmt.Errorf(\"Invalid unblock channel given\")\n\t} else if c.Lifecycle == nil {\n\t\treturn fmt.Errorf(\"Invalid lifecycle hooks given\")\n\t} else if c.Events == nil {\n\t\treturn fmt.Errorf(\"Invalid event hook given\")\n\t} else if c.ClientConfig == nil {\n\t\treturn fmt.Errorf(\"Invalid client config given\")\n\t} else if c.TaskDir == \"\" {\n\t\treturn fmt.Errorf(\"Invalid task directory given: %q\", c.TaskDir)\n\t} else if c.EnvBuilder == nil {\n\t\treturn fmt.Errorf(\"Invalid task environment given\")\n\t} else if c.MaxTemplateEventRate == 0 {\n\t\treturn fmt.Errorf(\"Invalid max template event rate given\")\n\t}\n\n\t// Once is a runner config, but in Nomad it is set per template, so all\n\t// templates given to a runner should have the same value for Once.\n\tvar once bool\n\tfor i, t := range c.Templates {\n\t\tif i == 0 {\n\t\t\tonce = t.Once\n\t\t} else if t.Once != once {\n\t\t\treturn fmt.Errorf(\"All templates should have same Once value\")","sourceCodeStart":140,"sourceCodeEnd":176,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/client/allocrunner/taskrunner/template/template.go#L140-L176","documentation":"Sentinel validation guard in TaskTemplateManagerConfig.Validate: the Events channel was not set, so template render events could not be delivered to the task runner. Raised from NewTaskTemplateManager when the config struct was built without an event hook.","triggerScenarios":"Thrown at client/allocrunner/taskrunner/template/template.go:158 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Assign a valid Events channel on TaskTemplateManagerConfig before constructing the manager","Check the config-building code path so the event hook is always wired up"],"exampleFix":null,"handlingStrategy":"validation","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"}