hashicorp/nomad · error

format error: %w

Error message

format error: %w

What it means

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.

Source

Thrown at command/volume_status_host.go:118

		exactMatchesCount := 0
		for _, vol := range vols {
			if vol.ID == prefix || vol.Name == prefix {
				exactMatchesCount++
				match = vol
			}
		}
		if exactMatchesCount == 1 {
			return match, nil, nil
		}
		return nil, vols, nil
	}
}

func formatHostVolume(vol *api.HostVolume, opts formatOpts) (string, error) {
	if opts.json || len(opts.template) > 0 {
		out, err := Format(opts.json, opts.template, vol)
		if err != nil {
			return "", fmt.Errorf("format error: %w", err)
		}
		return out, nil
	}

	output := []string{
		fmt.Sprintf("ID|%s", vol.ID),
		fmt.Sprintf("Name|%s", vol.Name),
		fmt.Sprintf("Namespace|%s", vol.Namespace),
		fmt.Sprintf("Plugin ID|%s", vol.PluginID),
		fmt.Sprintf("Node ID|%s", vol.NodeID),
		fmt.Sprintf("Node Pool|%s", vol.NodePool),
		fmt.Sprintf("Capacity|%s", humanize.IBytes(uint64(vol.CapacityBytes))),
		fmt.Sprintf("State|%s", vol.State),
		fmt.Sprintf("Host Path|%s", vol.HostPath),
	}

	// Exit early
	if opts.short {

View on GitHub (pinned to 482b49bf1a)

Solutions

  1. Fix the -json/-t template expression against the host volume schema
  2. Use default table output (omit -json and -t)
  3. Validate the template parses standalone before embedding in scripts
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at command/volume_status_host.go:118 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/d3926839b5633f62. Report an issue: GitHub.