{"record":{"id":"1b0632acee8b3c4f","repo":"cilium/cilium","slug":"unsupported-format-s","errorCode":null,"errorMessage":"unsupported format: %s","messagePattern":"unsupported format: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"pkg/bgp/commands/peer.go","lineNumber":90,"sourceCode":"\t\t\t\t\tout, err := json.MarshalIndent(table, \"\", \"  \")\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn \"\", \"\", fmt.Errorf(\"json marshal failed: %w\", err)\n\t\t\t\t\t}\n\t\t\t\t\tif _, err := w.Write(out); err != nil {\n\t\t\t\t\t\treturn \"\", \"\", err\n\t\t\t\t\t}\n\t\t\t\tcase \"json\":\n\t\t\t\t\tout, err := json.MarshalIndent(res.Instances, \"\", \"  \")\n\t\t\t\t\tif err != nil {\n\t\t\t\t\t\treturn \"\", \"\", fmt.Errorf(\"json marshal failed: %w\", err)\n\t\t\t\t\t}\n\t\t\t\t\tif _, err := w.Write(out); err != nil {\n\t\t\t\t\t\treturn \"\", \"\", err\n\t\t\t\t\t}\n\t\t\t\tcase \"detailed\":\n\t\t\t\t\tPrintPeerStatesDetailed(w, res.Instances, noUptime)\n\t\t\t\tdefault:\n\t\t\t\t\treturn \"\", \"\", fmt.Errorf(\"unsupported format: %s\", format)\n\t\t\t\t}\n\n\t\t\t\treturn buf.String(), \"\", err\n\t\t\t}, nil\n\t\t},\n\t)\n}\n\nfunc PrintPeerStatesTable(w io.Writer, instances []agent.InstancePeerStates, noUptime bool) {\n\ttype row struct {\n\t\tInstance     string\n\t\tPeer         string\n\t\tSessionState string\n\t\tUptime       string\n\t\tFamily       string\n\t\tReceived     string\n\t\tAccepted     string\n\t\tAdvertised   string","sourceCodeStart":72,"sourceCodeEnd":108,"githubUrl":"https://github.com/cilium/cilium/blob/ac7b90affa4baf0642e6685319d56907b3a73a6d/pkg/bgp/commands/peer.go#L72-L108","documentation":"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.","triggerScenarios":"Running the peer CLI command with an unrecognized --format/-f value such as \"txt\", \"yaml\", or a typo like \"jsn\".","commonSituations":"Typos in scripts/automation; using format names from other CLI tools (e.g. frr's \"json\" variants) that this tool does not support.","solutions":["Use one of the supported formats: table-json, json, or detailed","Check the command's help/usage text for the exact accepted values","Fix typos in scripts invoking the command"],"exampleFix":"// before\nbgpctl peer --format yaml\n// after\nbgpctl peer --format json","handlingStrategy":"validation","validationCode":"var supportedFormats = map[string]bool{\"table-json\": true, \"json\": true, \"detailed\": true}\nif !supportedFormats[format] {\n    return fmt.Errorf(\"unsupported format: %s\", format)\n}","typeGuard":"func isSupportedFormat(f string) bool {\n    return f == \"table-json\" || f == \"json\" || f == \"detailed\"\n}","tryCatchPattern":"out, err := runPeerCommand(format)\nif err != nil {\n    var unsupported *UnsupportedFormatError\n    if errors.As(err, &unsupported) {\n        format = \"json\" // fallback\n        out, err = runPeerCommand(format)\n    }\n}","preventionTips":["Whitelist formats in wrapper scripts","Read --help for accepted values","Avoid copying format flags from other CLI tools"],"tags":["bgp","cli","argument-validation"],"backgroundTag":"unsupported-format","analyzedSha":"ac7b90affa4baf0642e6685319d56907b3a73a6d","analyzedAt":"2026-08-31T18:27:15.868Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}