{"record":{"id":"feea553c86b43f30","repo":"hashicorp/nomad","slug":"volume-has-unrecognized-type-s","errorCode":null,"errorMessage":"volume has unrecognized type %s","messagePattern":"volume has unrecognized type (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"nomad/structs/volumes.go","lineNumber":150,"sourceCode":"\t\treturn false\n\tcase v.Sticky != o.Sticky:\n\t\treturn false\n\tcase v.AccessMode != o.AccessMode:\n\t\treturn false\n\tcase v.AttachmentMode != o.AttachmentMode:\n\t\treturn false\n\tcase !v.MountOptions.Equal(o.MountOptions):\n\t\treturn false\n\tcase v.PerAlloc != o.PerAlloc:\n\t\treturn false\n\t}\n\treturn true\n}\n\nfunc (v *VolumeRequest) Validate(jobType string, taskGroupCount, canaries int) error {\n\tif !(v.Type == VolumeTypeHost ||\n\t\tv.Type == VolumeTypeCSI) {\n\t\treturn fmt.Errorf(\"volume has unrecognized type %s\", v.Type)\n\t}\n\n\tvar mErr multierror.Error\n\taddErr := func(msg string, args ...any) {\n\t\tmErr.Errors = append(mErr.Errors, fmt.Errorf(msg, args...))\n\t}\n\n\tif v.Source == \"\" {\n\t\taddErr(\"volume has an empty source\")\n\t}\n\tif v.PerAlloc {\n\t\tif jobType == JobTypeSystem || jobType == JobTypeSysBatch {\n\t\t\taddErr(\"volume cannot be per_alloc for system or sysbatch jobs\")\n\t\t}\n\t\tif canaries > 0 {\n\t\t\taddErr(\"volume cannot be per_alloc when canaries are in use\")\n\t\t}\n\t\tif v.Sticky {","sourceCodeStart":132,"sourceCodeEnd":168,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/nomad/structs/volumes.go#L132-L168","documentation":"VolumeRequest.Validate returns this error when the volume's Type is neither \"host\" nor \"csi\". Nomad only recognizes these two volume types for volume requests, so any other value makes the whole request invalid immediately.","triggerScenarios":"Calling Validate(jobType, taskGroupCount, canaries) on a VolumeRequest whose Type is not VolumeTypeHost (\"host\") or VolumeTypeCSI (\"csi\") — e.g. type = \"local\" or a typo like \"hosts\" in a job spec's volume block.","commonSituations":"Typo in the volume type field of a job file; using types from other orchestrators (e.g. Kubernetes 'persistentVolumeClaim'); older configs predating CSI volume support that used now-removed type names.","solutions":["Set the volume's type to \"host\" or \"csi\".","Check the error message suffix for the exact unrecognized type string and fix the spelling.","For dynamic/host volume workflows verify the correct type keyword against your Nomad version's docs."],"exampleFix":"// before\nvolume \"db\" { type = \"persistent\" }\n// after\nvolume \"db\" { type = \"csi\" }","handlingStrategy":"validation","validationCode":"if v.Type != \"host\" && v.Type != \"csi\" {\n    return fmt.Errorf(\"volume type must be host or csi, got %q\", v.Type)\n}","typeGuard":"func isValidVolumeType(t string) bool {\n    return t == \"host\" || t == \"csi\"\n}","tryCatchPattern":null,"preventionTips":["Use only \"host\" or \"csi\" as volume types.","Run `nomad job validate` on job files before submission.","Check your Nomad version's docs for the supported volume type keywords."],"tags":["nomad","volumes","validation","config"],"backgroundTag":"invalid-enum-value","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"}