hashicorp/nomad · error
Failed to parse %q as octal: %v
Error message
Failed to parse %q as octal: %v
What it means
In parseTemplateConfigs, the template block's Perms value is parsed as an octal uint via strconv.ParseUint(tmpl.Perms, 8, 12); it fires when a job spec supplies a permissions string that is not valid octal (e.g. "abc" or out-of-range values), so file permissions cannot be set for the rendered artifact.
Source
Thrown at client/allocrunner/taskrunner/template/template.go:816
}
if tmpl.Wait != nil {
if err := tmpl.Wait.Validate(); err != nil {
return nil, err
}
ct.Wait = &ctconf.WaitConfig{
Enabled: new(true),
Min: tmpl.Wait.Min,
Max: tmpl.Wait.Max,
}
}
// Set the permissions
if tmpl.Perms != "" {
v, err := strconv.ParseUint(tmpl.Perms, 8, 12)
if err != nil {
return nil, fmt.Errorf("Failed to parse %q as octal: %v", tmpl.Perms, err)
}
m := os.FileMode(v)
ct.Perms = &m
}
// Set ownership
if tmpl.Uid != nil && *tmpl.Uid >= 0 {
ct.Uid = tmpl.Uid
}
if tmpl.Gid != nil && *tmpl.Gid >= 0 {
ct.Gid = tmpl.Gid
}
ct.Finalize()
ctmpls[ct] = tmpl
}
return ctmpls, nilView on GitHub (pinned to 482b49bf1a)
Solutions
- Fix the Perms field in the job's template block to a valid octal value (e.g. "0644")
- Validate perms at job-submission time in job validation instead of at task startup
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at client/allocrunner/taskrunner/template/template.go:816 when the library encounters an invalid state.
Common situations: See trigger scenarios.
Understand the failure class
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
AI-assisted analysis of hashicorp/nomad@482b49bf1a (2026-09-04).
Data as JSON: /api/errors/30bd2dfabcf527f1.
Report an issue: GitHub.