{"record":{"id":"d3926839b5633f62","repo":"hashicorp/nomad","slug":"format-error-w-d39268","errorCode":null,"errorMessage":"format error: %w","messagePattern":"format error: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"command/volume_status_host.go","lineNumber":118,"sourceCode":"\t\texactMatchesCount := 0\n\t\tfor _, vol := range vols {\n\t\t\tif vol.ID == prefix || vol.Name == prefix {\n\t\t\t\texactMatchesCount++\n\t\t\t\tmatch = vol\n\t\t\t}\n\t\t}\n\t\tif exactMatchesCount == 1 {\n\t\t\treturn match, nil, nil\n\t\t}\n\t\treturn nil, vols, nil\n\t}\n}\n\nfunc formatHostVolume(vol *api.HostVolume, opts formatOpts) (string, error) {\n\tif opts.json || len(opts.template) > 0 {\n\t\tout, err := Format(opts.json, opts.template, vol)\n\t\tif err != nil {\n\t\t\treturn \"\", fmt.Errorf(\"format error: %w\", err)\n\t\t}\n\t\treturn out, nil\n\t}\n\n\toutput := []string{\n\t\tfmt.Sprintf(\"ID|%s\", vol.ID),\n\t\tfmt.Sprintf(\"Name|%s\", vol.Name),\n\t\tfmt.Sprintf(\"Namespace|%s\", vol.Namespace),\n\t\tfmt.Sprintf(\"Plugin ID|%s\", vol.PluginID),\n\t\tfmt.Sprintf(\"Node ID|%s\", vol.NodeID),\n\t\tfmt.Sprintf(\"Node Pool|%s\", vol.NodePool),\n\t\tfmt.Sprintf(\"Capacity|%s\", humanize.IBytes(uint64(vol.CapacityBytes))),\n\t\tfmt.Sprintf(\"State|%s\", vol.State),\n\t\tfmt.Sprintf(\"Host Path|%s\", vol.HostPath),\n\t}\n\n\t// Exit early\n\tif opts.short {","sourceCodeStart":100,"sourceCodeEnd":136,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/command/volume_status_host.go#L100-L136","documentation":"Returned by formatHostVolume when the generic Format helper fails to render a single host volume as JSON or via go-template. The volume data itself is fine; the requested output format could not be produced.","triggerScenarios":"Thrown at command/volume_status_host.go:118 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Fix the -json/-t template expression against the host volume schema","Use default table output (omit -json and -t)","Validate the template parses standalone before embedding in scripts"],"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"}