{"record":{"id":"a4c527ae0d0a7b85","repo":"hashicorp/nomad","slug":"unrecognized-unit-q","errorCode":null,"errorMessage":"unrecognized unit %q","messagePattern":"unrecognized unit %q","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"plugins/shared/structs/attribute.go","lineNumber":249,"sourceCode":"\t\tb.WriteString(fmt.Sprintf(\"%v\", *a.Int))\n\t} else if a.Bool != nil {\n\t\tb.WriteString(fmt.Sprintf(\"%v\", *a.Bool))\n\t} else if a.String != nil {\n\t\tb.WriteString(*a.String)\n\t}\n\n\tif a.Unit != \"\" {\n\t\tb.WriteString(a.Unit)\n\t}\n\n\treturn b.String()\n}\n\n// Validate checks if the attribute is valid\nfunc (a *Attribute) Validate() error {\n\tif a.Unit != \"\" {\n\t\tif _, ok := UnitIndex[a.Unit]; !ok {\n\t\t\treturn fmt.Errorf(\"unrecognized unit %q\", a.Unit)\n\t\t}\n\n\t\t// Check only int/float set\n\t\tif a.String != nil || a.Bool != nil {\n\t\t\treturn fmt.Errorf(\"unit can not be specified on a boolean or string attribute\")\n\t\t}\n\t}\n\n\t// Assert only one of the attributes is set\n\tset := 0\n\tif a.Float != nil {\n\t\tset++\n\t}\n\tif a.Int != nil {\n\t\tset++\n\t}\n\tif a.String != nil {\n\t\tset++","sourceCodeStart":231,"sourceCodeEnd":267,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/plugins/shared/structs/attribute.go#L231-L267","documentation":"Attribute.Validate: the attribute carries a Unit string that is not in the UnitIndex lookup of recognized units, so it cannot be interpreted for constraints or comparisons.","triggerScenarios":"Thrown at plugins/shared/structs/attribute.go:249 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use a recognized unit from the UnitIndex set","Omit the unit if the attribute does not need one"],"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-08T15:18:49.778Z"}