cilium/cilium · warning

invalid output format: %s

Error message

invalid output format: %s

What it means

runStatus validates the --output flag against known printer formats (compact, json/jsonpb, tab/table, etc.). Any unrecognized value hits the default branch and yields 'invalid output format: %s'.

Source

Thrown at hubble/cmd/status/status.go:109

	ss, err := getStatus(ctx, conn)
	if err != nil {
		return fmt.Errorf("failed to get hubble server status: %w", err)
	}

	var opts = []printer.Option{
		printer.Writer(out),
	}
	switch formattingOpts.output {
	case "compact":
		opts = append(opts, printer.Compact())
	case "dict":
		opts = append(opts, printer.Dict())
	case "json", "JSON", "jsonpb":
		opts = append(opts, printer.JSONPB())
	case "tab", "table":
		opts = append(opts, printer.Tab())
	default:
		return fmt.Errorf("invalid output format: %s", formattingOpts.output)
	}
	p := printer.New(opts...)
	if err := p.WriteServerStatusResponse(ss); err != nil {
		return err
	}
	return p.Close()
}

func getHC(ctx context.Context, conn *grpc.ClientConn) (healthy bool, status string, err error) {
	req := &healthpb.HealthCheckRequest{Service: v1.ObserverServiceName}
	resp, err := healthpb.NewHealthClient(conn).Check(ctx, req)
	if err != nil {
		return false, "", err
	}
	if st := resp.GetStatus(); st != healthpb.HealthCheckResponse_SERVING {
		return false, fmt.Sprintf("Unavailable: %s", st), nil
	}
	return true, "Ok", nil

View on GitHub (pinned to ac7b90affa)

Solutions

  1. Use one of the supported values: compact, json, jsonpb, tab or table.
  2. Check exact spelling/case; the accepted set is small and case-sensitive for json aliases (json/JSON/jsonpb).
  3. Run `hubble status --help` to list valid --output values.
  4. If you need yaml, pipe the json output through a converter (e.g. `| y`).

Example fix

// before
hubble status --output yaml
// after
hubble status --output json
Defensive patterns

Strategy: validation

Validate before calling

var validFormats = map[string]bool{
    "compact": true, "json": true, "JSON": true, "jsonpb": true,
    "tab": true, "table": true,
}
if !validFormats[output] {
    return fmt.Errorf("invalid output format: %s", output)
}

Prevention

When it happens

Trigger: Running `hubble status --output <value>` where value is not one of compact|json|JSON|jsonpb|tab|table (and the configured aliases).

Common situations: Typos like `--output=jason`, `--output yaml` (yaml is unsupported), or scripts passing a format copied from another tool.

Related errors


AI-assisted analysis of cilium/cilium@ac7b90affa (2026-08-31). Data as JSON: /api/errors/8c73b42c78fe5969. Report an issue: GitHub.