{"record":{"id":"a7b072e1c08b3211","repo":"grpc-ecosystem/grpc-gateway","slug":"no-target-service-defined-in-the-file","errorCode":null,"errorMessage":"no target service defined in the file","messagePattern":"no target service defined in the file","errorType":"error_code","errorClass":"errNoTargetService","httpStatus":null,"severity":"error","filePath":"protoc-gen-grpc-gateway/internal/gengateway/generator.go","lineNumber":16,"sourceCode":"package gengateway\n\nimport (\n\t\"errors\"\n\t\"fmt\"\n\t\"go/format\"\n\t\"path\"\n\n\t\"github.com/grpc-ecosystem/grpc-gateway/v2/internal/descriptor\"\n\tgen \"github.com/grpc-ecosystem/grpc-gateway/v2/internal/generator\"\n\t\"google.golang.org/grpc/grpclog\"\n\t\"google.golang.org/protobuf/proto\"\n\t\"google.golang.org/protobuf/types/pluginpb\"\n)\n\nvar errNoTargetService = errors.New(\"no target service defined in the file\")\n\ntype generator struct {\n\treg                *descriptor.Registry\n\tbaseImports        []descriptor.GoPackage\n\tuseRequestContext  bool\n\tregisterFuncSuffix string\n\tallowPatchFeature  bool\n\tstandalone         bool\n\tuseOpaqueAPI       bool\n}\n\n// New returns a new generator which generates grpc gateway files.\nfunc New(reg *descriptor.Registry, useRequestContext bool, registerFuncSuffix string,\n\tallowPatchFeature, standalone bool, useOpaqueAPI bool) gen.Generator {\n\tvar imports []descriptor.GoPackage\n\tfor _, pkgpath := range []string{\n\t\t\"context\",\n\t\t\"errors\",","sourceCodeStart":1,"sourceCodeEnd":34,"githubUrl":"https://github.com/grpc-ecosystem/grpc-gateway/blob/a58a4436a376a4bcc7d8f10c4d4f919a8438bba9/protoc-gen-grpc-gateway/internal/gengateway/generator.go#L1-L34","documentation":"Sentinel error errNoTargetService raised when a proto FileDescriptor contains no service with google.api.Http annotations (or none selected via the registry). The gateway generator returns it to signal that nothing should be generated for this file; the plugin treats it as a benign skip (logged only at grpclog V(1)) rather than a hard failure.","triggerScenarios":"Thrown at protoc-gen-grpc-gateway/internal/gengateway/generator.go:16 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["If generation is expected, add a service with google.api.http annotations (or google.api.http rules) to the proto file.","Verify the service name is not filtered out by the plugin's service allow/deny configuration.","Ignore if the file legitimately contains no HTTP-annotated services."],"exampleFix":null,"handlingStrategy":"fallback","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"}