grpc-ecosystem/grpc-gateway · error
no service %s found
Error message
no service %s found
What it means
Service-level options are checked against the set of fully-qualified service names built from registered files. If opts.Service names a service not found in that set, the registry returns this error rather than dropping the option silently.
Source
Thrown at internal/descriptor/registry.go:797
qualifiedMethod := "." + opt.Method
if _, ok := methods[qualifiedMethod]; !ok {
return fmt.Errorf("no method %s found", opt.Method)
}
r.methodOptions[qualifiedMethod] = opt.Option
}
for _, opt := range opts.Message {
qualifiedMessage := "." + opt.Message
if _, ok := r.msgs[qualifiedMessage]; !ok {
return fmt.Errorf("no message %s found", opt.Message)
}
r.messageOptions[qualifiedMessage] = opt.Option
}
for _, opt := range opts.Service {
qualifiedService := "." + opt.Service
if _, ok := services[qualifiedService]; !ok {
return fmt.Errorf("no service %s found", opt.Service)
}
r.serviceOptions[qualifiedService] = opt.Option
}
// build map of all registered fields
fields := make(map[string]struct{})
for _, m := range r.msgs {
for _, f := range m.Fields {
fields[f.FQFN()] = struct{}{}
}
}
for _, opt := range opts.Field {
qualifiedField := "." + opt.Field
if _, ok := fields[qualifiedField]; !ok {
return fmt.Errorf("no field %s found", opt.Field)
}
r.fieldOptions[qualifiedField] = opt.Option
}View on GitHub (pinned to a58a4436a3)
Solutions
- Use the fully-qualified service name: pkg.ServiceName
- Ensure the .proto defining the service is in the load set
- Sync your options file with the current proto definitions
- Check for typos and correct package prefix
Example fix
// before Service: "EchoService" // after Service: "grpc.gateway.examples.v1.EchoService"
Defensive patterns
Strategy: validation
Validate before calling
want := "." + opt.Service
if !knownServices[want] {
return fmt.Errorf("service %q not found; use pkg.Service", opt.Service)
}
err = reg.RegisterOptions(opts) Prevention
- Include the proto package prefix in every service reference
- Ensure every proto defining an options-targeted service is in the generator's file set
- Validate options targets against the compiled FileDescriptorSet before running the plugin
When it happens
Trigger: Registering options with opts.Service set to a service that is misspelled, lacks its package prefix, was removed/renamed, or whose defining file was not loaded.
Common situations: Options config copied from another API; service renamed in a major-version bump; running the generator only on a subset of protos while the options file still targets services from the full set.
Related errors
- no file %s found
- no method %s found
- no message %s found
- no field %s found
- no target service defined in the file
AI-assisted analysis of grpc-ecosystem/grpc-gateway@a58a4436a3 (2026-09-02).
Data as JSON: /api/errors/0d303c8e54352bf0.
Report an issue: GitHub.