{"record":{"id":"3e7b57d9d27f8cfc","repo":"hashicorp/nomad","slug":"error-formatting-host-volumes-w","errorCode":null,"errorMessage":"Error formatting host volumes: %w","messagePattern":"Error formatting host volumes: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"command/volume_status_host.go","lineNumber":76,"sourceCode":"\tif !(opts.json || len(opts.template) > 0) {\n\t\tc.Ui.Output(c.Colorize().Color(\"[bold]Dynamic Host Volumes[reset]\"))\n\t}\n\n\tvols, _, err := client.HostVolumes().List(&api.HostVolumeListRequest{\n\t\tNodeID:   nodeID,\n\t\tNodePool: nodePool,\n\t}, nil)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Error querying host volumes: %w\", err)\n\t}\n\tif len(vols) == 0 {\n\t\tc.Ui.Error(\"No dynamic host volumes\")\n\t\treturn nil // empty is not an error\n\t}\n\n\tstr, err := formatHostVolumes(vols, opts)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Error formatting host volumes: %w\", err)\n\t}\n\tc.Ui.Output(c.Colorize().Color(str))\n\treturn nil\n}\n\nfunc getHostVolumeByPrefix(client *api.Client, prefix, ns string) (*api.HostVolumeStub, []*api.HostVolumeStub, error) {\n\tvols, _, err := client.HostVolumes().List(nil, &api.QueryOptions{\n\t\tPrefix:    prefix,\n\t\tNamespace: ns,\n\t})\n\n\tif err != nil {\n\t\treturn nil, nil, fmt.Errorf(\"error querying volumes: %w\", err)\n\t}\n\tswitch len(vols) {\n\tcase 0:\n\t\treturn nil, nil, fmt.Errorf(\"no volumes with prefix or ID %q found\", prefix)\n\tcase 1:","sourceCodeStart":58,"sourceCodeEnd":94,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/command/volume_status_host.go#L58-L94","documentation":"Fires in hostVolumeList after volumes were fetched: rendering them via formatHostVolumes failed, typically because the JSON or go-template output options are malformed.","triggerScenarios":"Thrown at command/volume_status_host.go:76 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the -json/-t template syntax against the volume stub schema","Retry without formatting overrides to use the default table output","Report a bug if the default format path fails"],"exampleFix":null,"handlingStrategy":"try-catch","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"}