hashicorp/nomad · error
Error formatting host volumes: %w
Error message
Error formatting host volumes: %w
What it means
Fires in hostVolumeList after volumes were fetched: rendering them via formatHostVolumes failed, typically because the JSON or go-template output options are malformed.
Source
Thrown at command/volume_status_host.go:76
if !(opts.json || len(opts.template) > 0) {
c.Ui.Output(c.Colorize().Color("[bold]Dynamic Host Volumes[reset]"))
}
vols, _, err := client.HostVolumes().List(&api.HostVolumeListRequest{
NodeID: nodeID,
NodePool: nodePool,
}, nil)
if err != nil {
return fmt.Errorf("Error querying host volumes: %w", err)
}
if len(vols) == 0 {
c.Ui.Error("No dynamic host volumes")
return nil // empty is not an error
}
str, err := formatHostVolumes(vols, opts)
if err != nil {
return fmt.Errorf("Error formatting host volumes: %w", err)
}
c.Ui.Output(c.Colorize().Color(str))
return nil
}
func getHostVolumeByPrefix(client *api.Client, prefix, ns string) (*api.HostVolumeStub, []*api.HostVolumeStub, error) {
vols, _, err := client.HostVolumes().List(nil, &api.QueryOptions{
Prefix: prefix,
Namespace: ns,
})
if err != nil {
return nil, nil, fmt.Errorf("error querying volumes: %w", err)
}
switch len(vols) {
case 0:
return nil, nil, fmt.Errorf("no volumes with prefix or ID %q found", prefix)
case 1:View on GitHub (pinned to 482b49bf1a)
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
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at command/volume_status_host.go:76 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of hashicorp/nomad@482b49bf1a (2026-09-04).
Data as JSON: /api/errors/3e7b57d9d27f8cfc.
Report an issue: GitHub.