{"record":{"id":"6e507e1f0b3abc03","repo":"hashicorp/nomad","slug":"minimum-cpu-value-is-d-got-d","errorCode":null,"errorMessage":"minimum CPU value is %d; got %d","messagePattern":"minimum CPU value is (.+?); got (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"nomad/structs/structs.go","lineNumber":2602,"sourceCode":"\t\tr.Devices = nil\n\t}\n\n\tfor _, n := range r.Networks {\n\t\tn.Canonicalize()\n\t}\n\n\tr.NUMA.Canonicalize()\n}\n\n// MeetsMinResources returns an error if the resources specified are less than\n// the minimum allowed.\n// This is based on the minimums defined in the Resources type\n// COMPAT(0.10): Remove in 0.10\nfunc (r *Resources) MeetsMinResources() error {\n\tvar mErr multierror.Error\n\tminResources := MinResources()\n\tif r.CPU < minResources.CPU && r.Cores == 0 {\n\t\tmErr.Errors = append(mErr.Errors, fmt.Errorf(\"minimum CPU value is %d; got %d\", minResources.CPU, r.CPU))\n\t}\n\tif r.MemoryMB < minResources.MemoryMB {\n\t\tmErr.Errors = append(mErr.Errors, fmt.Errorf(\"minimum MemoryMB value is %d; got %d\", minResources.MemoryMB, r.MemoryMB))\n\t}\n\treturn mErr.ErrorOrNil()\n}\n\n// Copy returns a deep copy of the resources\nfunc (r *Resources) Copy() *Resources {\n\tif r == nil {\n\t\treturn nil\n\t}\n\treturn &Resources{\n\t\tCPU:         r.CPU,\n\t\tCores:       r.Cores,\n\t\tMemoryMB:    r.MemoryMB,\n\t\tMemoryMaxMB: r.MemoryMaxMB,\n\t\tDiskMB:      r.DiskMB,","sourceCodeStart":2584,"sourceCodeEnd":2620,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/nomad/structs/structs.go#L2584-L2620","documentation":"Resources.MeetsMinResources() (a COMPAT/0.10 legacy check) verifies that a task's CPU request meets the cluster's minimum defined by MinResources(). The check is skipped when the job uses the newer Cores field (r.Cores != 0), since cores-based specs define CPU differently.","triggerScenarios":"Submitting a job spec with Resources.CPU below the MinResources() CPU floor while Cores is 0, e.g. cpu = 50 with minimum 100.","commonSituations":"Porting old or hand-minimized job files; downgrading CPU to fit more tasks; specs written for clusters with different minimums; legacy templates predating current minimums.","solutions":["Raise Resources.CPU (cpu) to at least minResources.CPU as reported in the error","Use the Cores field instead for CPU allocation, which bypasses the legacy CPU check","Update the job template to current Nomad minimum resource values"],"exampleFix":"// before\nresources {\n  cpu = 50\n}\n// after\nresources {\n  cpu = 100\n}","handlingStrategy":"validation","validationCode":"min := structs.MinResources()\nif r.Cores == 0 && r.CPU < min.CPU {\n    return fmt.Errorf(\"cpu must be >= %d\", min.CPU)\n}","typeGuard":"func meetsMinCPU(r *structs.Resources) bool { return r.Cores != 0 || r.CPU >= structs.MinResources().CPU }","tryCatchPattern":null,"preventionTips":["Pin CPU requests to at least the minimum in job templates","Prefer the cores field for CPU allocation on newer Nomad","Refresh templates when upgrading Nomad versions as minimums change"],"tags":["nomad","resources","validation","cpu"],"backgroundTag":"resource-spec-validation","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"}