{"record":{"id":"8858a7ac3825c001","repo":"hashicorp/nomad","slug":"template-render-subprocess-failed-w","errorCode":null,"errorMessage":"template render subprocess failed: %w","messagePattern":"template render subprocess failed: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"client/allocrunner/taskrunner/template/template_default.go","lineNumber":140,"sourceCode":"\t\t\tperms:       strconv.FormatUint(uint64(i.Perms), 8),\n\t\t\tuser:        i.User,\n\t\t\tgroup:       i.Group,\n\t\t\ttaskID:      taskID,\n\t\t\tcontents:    i.Contents,\n\t\t}\n\n\t\tlogs, code, err := renderTemplateInSandbox(sandboxCfg)\n\t\tif err != nil {\n\t\t\tif len(logs) > 0 {\n\t\t\t\tlog.Printf(\"[ERROR] %v: %s\", err, logs)\n\t\t\t} else {\n\t\t\t\tlog.Printf(\"[ERROR] %v\", err)\n\t\t\t}\n\t\t\treturn &renderer.RenderResult{\n\t\t\t\tDidRender:   false,\n\t\t\t\tWouldRender: false,\n\t\t\t\tContents:    []byte{},\n\t\t\t}, fmt.Errorf(\"template render subprocess failed: %w\", err)\n\t\t}\n\t\tif code == trenderer.ExitWouldRenderButDidnt {\n\t\t\tdidRender = false\n\t\t\twouldRender = true\n\t\t} else {\n\t\t\tdidRender = true\n\t\t\twouldRender = true\n\t\t}\n\n\t\t// the subprocess emits logs matching the consul-template runner, but we\n\t\t// CT doesn't support hclog, so we just print the whole output here to\n\t\t// stderr the same way CT does so the results look seamless\n\t\tif len(logs) > 0 {\n\t\t\tlog.Printf(\"[DEBUG] %s\", logs)\n\t\t}\n\n\t\tresult := &renderer.RenderResult{\n\t\t\tDidRender:   didRender,","sourceCodeStart":122,"sourceCodeEnd":158,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/client/allocrunner/taskrunner/template/template_default.go#L122-L158","documentation":"In the default template runner, rendering is delegated to a sandboxed subprocess (renderTemplateInSandbox); this error wraps any failure of that subprocess — exec failure, sandbox config error, or non-zero unexpected exit — so the caller receives DidRender=false and a wrapped cause while logs are emitted.","triggerScenarios":"Thrown at client/allocrunner/taskrunner/template/template_default.go:140 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the logged subprocess output for the root cause","Verify the sandbox config (paths, user/group, permissions) is valid","Check that the task directory and template destination are writable by the render user"],"exampleFix":null,"handlingStrategy":"retry","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-08T15:18:49.778Z"}