{"record":{"id":"30bd2dfabcf527f1","repo":"hashicorp/nomad","slug":"failed-to-parse-q-as-octal-v","errorCode":null,"errorMessage":"Failed to parse %q as octal: %v","messagePattern":"Failed to parse %q as octal: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"client/allocrunner/taskrunner/template/template.go","lineNumber":816,"sourceCode":"\t\t}\n\n\t\tif tmpl.Wait != nil {\n\t\t\tif err := tmpl.Wait.Validate(); err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\n\t\t\tct.Wait = &ctconf.WaitConfig{\n\t\t\t\tEnabled: new(true),\n\t\t\t\tMin:     tmpl.Wait.Min,\n\t\t\t\tMax:     tmpl.Wait.Max,\n\t\t\t}\n\t\t}\n\n\t\t// Set the permissions\n\t\tif tmpl.Perms != \"\" {\n\t\t\tv, err := strconv.ParseUint(tmpl.Perms, 8, 12)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"Failed to parse %q as octal: %v\", tmpl.Perms, err)\n\t\t\t}\n\t\t\tm := os.FileMode(v)\n\t\t\tct.Perms = &m\n\t\t}\n\t\t// Set ownership\n\t\tif tmpl.Uid != nil && *tmpl.Uid >= 0 {\n\t\t\tct.Uid = tmpl.Uid\n\t\t}\n\t\tif tmpl.Gid != nil && *tmpl.Gid >= 0 {\n\t\t\tct.Gid = tmpl.Gid\n\t\t}\n\n\t\tct.Finalize()\n\n\t\tctmpls[ct] = tmpl\n\t}\n\n\treturn ctmpls, nil","sourceCodeStart":798,"sourceCodeEnd":834,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/client/allocrunner/taskrunner/template/template.go#L798-L834","documentation":"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.","triggerScenarios":"Thrown at client/allocrunner/taskrunner/template/template.go:816 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","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"],"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"}