cilium/cilium · warning

unsupported format: %s

Error message

unsupported format: %s

What it means

The BGP peer command accepts output formats table-json, json, and detailed; this error is returned for any other format string supplied by the user. It is argument validation, thrown from the command's default case.

Source

Thrown at pkg/bgp/commands/peer.go:90

					out, err := json.MarshalIndent(table, "", "  ")
					if err != nil {
						return "", "", fmt.Errorf("json marshal failed: %w", err)
					}
					if _, err := w.Write(out); err != nil {
						return "", "", err
					}
				case "json":
					out, err := json.MarshalIndent(res.Instances, "", "  ")
					if err != nil {
						return "", "", fmt.Errorf("json marshal failed: %w", err)
					}
					if _, err := w.Write(out); err != nil {
						return "", "", err
					}
				case "detailed":
					PrintPeerStatesDetailed(w, res.Instances, noUptime)
				default:
					return "", "", fmt.Errorf("unsupported format: %s", format)
				}

				return buf.String(), "", err
			}, nil
		},
	)
}

func PrintPeerStatesTable(w io.Writer, instances []agent.InstancePeerStates, noUptime bool) {
	type row struct {
		Instance     string
		Peer         string
		SessionState string
		Uptime       string
		Family       string
		Received     string
		Accepted     string
		Advertised   string

View on GitHub (pinned to ac7b90affa)

Solutions

  1. Use one of the supported formats: table-json, json, or detailed
  2. Check the command's help/usage text for the exact accepted values
  3. Fix typos in scripts invoking the command

Example fix

// before
bgpctl peer --format yaml
// after
bgpctl peer --format json
Defensive patterns

Strategy: validation

Validate before calling

var supportedFormats = map[string]bool{"table-json": true, "json": true, "detailed": true}
if !supportedFormats[format] {
    return fmt.Errorf("unsupported format: %s", format)
}

Type guard

func isSupportedFormat(f string) bool {
    return f == "table-json" || f == "json" || f == "detailed"
}

Try / catch

out, err := runPeerCommand(format)
if err != nil {
    var unsupported *UnsupportedFormatError
    if errors.As(err, &unsupported) {
        format = "json" // fallback
        out, err = runPeerCommand(format)
    }
}

Prevention

When it happens

Trigger: Running the peer CLI command with an unrecognized --format/-f value such as "txt", "yaml", or a typo like "jsn".

Common situations: Typos in scripts/automation; using format names from other CLI tools (e.g. frr's "json" variants) that this tool does not support.

Related errors


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