hashicorp/nomad · error

template render subprocess failed: %w

Error message

template render subprocess failed: %w

What it means

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.

Source

Thrown at client/allocrunner/taskrunner/template/template_default.go:140

			perms:       strconv.FormatUint(uint64(i.Perms), 8),
			user:        i.User,
			group:       i.Group,
			taskID:      taskID,
			contents:    i.Contents,
		}

		logs, code, err := renderTemplateInSandbox(sandboxCfg)
		if err != nil {
			if len(logs) > 0 {
				log.Printf("[ERROR] %v: %s", err, logs)
			} else {
				log.Printf("[ERROR] %v", err)
			}
			return &renderer.RenderResult{
				DidRender:   false,
				WouldRender: false,
				Contents:    []byte{},
			}, fmt.Errorf("template render subprocess failed: %w", err)
		}
		if code == trenderer.ExitWouldRenderButDidnt {
			didRender = false
			wouldRender = true
		} else {
			didRender = true
			wouldRender = true
		}

		// the subprocess emits logs matching the consul-template runner, but we
		// CT doesn't support hclog, so we just print the whole output here to
		// stderr the same way CT does so the results look seamless
		if len(logs) > 0 {
			log.Printf("[DEBUG] %s", logs)
		}

		result := &renderer.RenderResult{
			DidRender:   didRender,

View on GitHub (pinned to 482b49bf1a)

Solutions

  1. Inspect the logged subprocess output for the root cause
  2. Verify the sandbox config (paths, user/group, permissions) is valid
  3. Check that the task directory and template destination are writable by the render user
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at client/allocrunner/taskrunner/template/template_default.go:140 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of hashicorp/nomad@482b49bf1a (2026-09-04). Data as JSON: /api/errors/8858a7ac3825c001. Report an issue: GitHub.