{"record":{"id":"a889fc3c88280b13","repo":"grpc-ecosystem/grpc-gateway","slug":"failed-to-read-openapi-configuration-description-f","errorCode":null,"errorMessage":"failed to read OpenAPI Configuration description from %q: %w","messagePattern":"failed to read OpenAPI Configuration description from %q: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/descriptor/openapi_configuration.go","lineNumber":55,"sourceCode":"func registerOpenAPIOptions(registry *Registry, openAPIConfig *openapiconfig.OpenAPIConfig, yamlSourceLogName string) error {\n\tif openAPIConfig.OpenapiOptions == nil {\n\t\t// Nothing to do\n\t\treturn nil\n\t}\n\n\tif err := registry.RegisterOpenAPIOptions(openAPIConfig.OpenapiOptions); err != nil {\n\t\treturn fmt.Errorf(\"failed to register option in %s: %w\", yamlSourceLogName, err)\n\t}\n\treturn nil\n}\n\n// LoadOpenAPIConfigFromYAML loads an  OpenAPI Configuration from the given YAML file\n// and registers the OpenAPI options the given registry.\n// This must be done after loading the proto file.\nfunc (r *Registry) LoadOpenAPIConfigFromYAML(yamlFile string) error {\n\tyamlFileContents, err := os.ReadFile(yamlFile)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to read OpenAPI Configuration description from %q: %w\", yamlFile, err)\n\t}\n\n\tconfig, err := loadOpenAPIConfigFromYAML(yamlFileContents, yamlFile)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn registerOpenAPIOptions(r, config, yamlFile)\n}\n","sourceCodeStart":37,"sourceCodeEnd":65,"githubUrl":"https://github.com/grpc-ecosystem/grpc-gateway/blob/a58a4436a376a4bcc7d8f10c4d4f919a8438bba9/internal/descriptor/openapi_configuration.go#L37-L65","documentation":"Registry.LoadOpenAPIConfigFromYAML wraps os.ReadFile failures when opening the OpenAPI configuration YAML file. It is identical in nature to the gRPC API Configuration read error, but for the OpenAPI config file; the OS error is preserved via %w.","triggerScenarios":"Calling LoadOpenAPIConfigFromYAML(yamlFile) (e.g. via the openapi_configuration option of protoc-gen-openapiv2) when the file path is wrong, missing, a directory, or unreadable.","commonSituations":"Misspelled file name on the protoc command line; config not present in the build sandbox; running protoc from a different working directory in CI vs locally.","solutions":["Check the exact path exists (ls <path>) and correct it","Use an absolute path or run protoc from the correct directory","Fix filesystem permissions","Ensure the file is created/copied before the protoc invocation in the build pipeline"],"exampleFix":"// before\n--openapiv2_opt=openapi_configuration=openapi_conf,yaml\n// after\n--openapiv2_opt=openapi_configuration=openapi_conf.yaml","handlingStrategy":"validation","validationCode":"const path = \"openapi_conf.yaml\"\nif _, err := os.Stat(path); err != nil {\n    return fmt.Errorf(\"OpenAPI config %q missing before load: %w\", path, err)\n}","typeGuard":null,"tryCatchPattern":"if err := reg.LoadOpenAPIConfigFromYAML(path); err != nil {\n    var pe *fs.PathError\n    if errors.As(err, &pe) {\n        log.Fatalf(\"cannot read OpenAPI config %q: %v\", pe.Path, pe.Err)\n    }\n    return err\n}","preventionTips":["Verify file name/extension on the protoc command line (common typo: ',yaml' suffix confusion)","Use absolute paths in build systems","Ensure the config exists before the protoc stage in CI","Keep configs under version control"],"tags":["filesystem","yaml-config","file-not-found"],"backgroundTag":"file-not-found","analyzedSha":"a58a4436a376a4bcc7d8f10c4d4f919a8438bba9","analyzedAt":"2026-09-02T10:28:31.537Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T16:17:10.729Z"}