{"record":{"id":"05227cae09aaaad0","repo":"grpc-ecosystem/grpc-gateway","slug":"unknown-format","errorCode":null,"errorMessage":"unknown format: ","messagePattern":"unknown format: ","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"protoc-gen-openapiv2/internal/genopenapi/format.go","lineNumber":27,"sourceCode":")\n\ntype Format string\n\nconst (\n\tFormatJSON Format = \"json\"\n\tFormatYAML Format = \"yaml\"\n)\n\ntype ContentEncoder interface {\n\tEncode(v interface{}) (err error)\n}\n\nfunc (f Format) Validate() error {\n\tswitch f {\n\tcase FormatJSON, FormatYAML:\n\t\treturn nil\n\tdefault:\n\t\treturn errors.New(\"unknown format: \" + string(f))\n\t}\n}\n\nfunc (f Format) NewEncoder(w io.Writer) (ContentEncoder, error) {\n\tswitch f {\n\tcase FormatYAML:\n\t\tenc := yaml.NewEncoder(w)\n\t\tenc.SetIndent(2)\n\n\t\treturn enc, nil\n\tcase FormatJSON:\n\t\tenc := json.NewEncoder(w)\n\t\tenc.SetIndent(\"\", \"  \")\n\n\t\treturn enc, nil\n\tdefault:\n\t\treturn nil, errors.New(\"unknown format: \" + string(f))\n\t}","sourceCodeStart":9,"sourceCodeEnd":45,"githubUrl":"https://github.com/grpc-ecosystem/grpc-gateway/blob/a58a4436a376a4bcc7d8f10c4d4f919a8438bba9/protoc-gen-openapiv2/internal/genopenapi/format.go#L9-L45","documentation":"Validation error from Format.Validate: the supplied output Format string is neither \"json\" nor \"yaml\". protoc-gen-openapiv2 only supports these two output encodings, so any other value (e.g. from the openapiv2_out format option) is rejected before encoding.","triggerScenarios":"Thrown at protoc-gen-openapiv2/internal/genopenapi/format.go:27 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set the output format option to \"json\" or \"yaml\".","Check for typos or stray whitespace/casing in the format parameter."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"a58a4436a376a4bcc7d8f10c4d4f919a8438bba9","analyzedAt":"2026-09-02T10:28:31.537Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T16:17:10.729Z"}