{"record":{"id":"5c6768004fdde609","repo":"hashicorp/nomad","slug":"cannot-use-signals-with-env-var-templates","errorCode":null,"errorMessage":"cannot use signals with env var templates","messagePattern":"cannot use signals with env var templates","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"nomad/structs/structs.go","lineNumber":8988,"sourceCode":"\t}\n\n\t// Verify the destination doesn't escape\n\tescaped, err := escapingfs.PathEscapesAllocViaRelative(\"task\", t.DestPath)\n\tif err != nil {\n\t\tmErr.Errors = append(mErr.Errors, fmt.Errorf(\"invalid destination path: %v\", err))\n\t} else if escaped {\n\t\tmErr.Errors = append(mErr.Errors, fmt.Errorf(\"destination escapes allocation directory\"))\n\t}\n\n\t// Verify a proper change mode\n\tswitch t.ChangeMode {\n\tcase TemplateChangeModeNoop, TemplateChangeModeRestart:\n\tcase TemplateChangeModeSignal:\n\t\tif t.ChangeSignal == \"\" {\n\t\t\t_ = multierror.Append(&mErr, fmt.Errorf(\"Must specify signal value when change mode is signal\"))\n\t\t}\n\t\tif t.Envvars {\n\t\t\t_ = multierror.Append(&mErr, fmt.Errorf(\"cannot use signals with env var templates\"))\n\t\t}\n\tcase TemplateChangeModeScript:\n\t\tif t.ChangeScript == nil {\n\t\t\t_ = multierror.Append(&mErr, fmt.Errorf(\"must specify change script configuration value when change mode is script\"))\n\t\t}\n\n\t\tif err = t.ChangeScript.Validate(); err != nil {\n\t\t\t_ = multierror.Append(&mErr, err)\n\t\t}\n\tdefault:\n\t\t_ = multierror.Append(&mErr, TemplateChangeModeInvalidError)\n\t}\n\n\t// Verify the splay is positive\n\tif t.Splay < 0 {\n\t\t_ = multierror.Append(&mErr, fmt.Errorf(\"Must specify positive splay value\"))\n\t}\n","sourceCodeStart":8970,"sourceCodeEnd":9006,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/nomad/structs/structs.go#L8970-L9006","documentation":"Appended by template validation when change_mode is \"signal\" and envvars templating is enabled. Signals cannot re-render environment variables of an already-started process, so the combination is invalid.","triggerScenarios":"Thrown at nomad/structs/structs.go:8988 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Remove envvars = true and write the rendered template to a file destination","Use change_mode = \"restart\" or \"noop\" if you need env-var templates"],"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"}