grpc-ecosystem/grpc-gateway · error
no field %s found
Error message
no field %s found
What it means
Field-level options are validated against a map of fully-qualified field names (FQFN) built from all registered messages. If opts.Field names a field whose qualified name is not present, this error is returned and option registration aborts.
Source
Thrown at internal/descriptor/registry.go:812
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
}
return nil
}
// GetOpenAPIFileOption returns a registered OpenAPI option for a file
func (r *Registry) GetOpenAPIFileOption(file string) (*options.Swagger, bool) {
opt, ok := r.fileOptions[file]
return opt, ok
}
// GetOpenAPIMethodOption returns a registered OpenAPI option for a method
func (r *Registry) GetOpenAPIMethodOption(qualifiedMethod string) (*options.Operation, bool) {
opt, ok := r.methodOptions[qualifiedMethod]
return opt, ok
}
View on GitHub (pinned to a58a4436a3)
Solutions
- Use the fully-qualified field name: pkg.Message.field
- Verify the field still exists on the message in the loaded protos
- Update the options entry after schema refactors
- Compare your field list against the registry's collected FQFNs
Example fix
// before Field: "Book.title" // after Field: "examples.library.v1.Book.title"
Defensive patterns
Strategy: validation
Validate before calling
want := "." + opt.Field
if !knownFields[want] {
return fmt.Errorf("field %q not found; use pkg.Message.field", opt.Field)
}
err = reg.RegisterOptions(opts) Prevention
- Use fully-qualified field names (pkg.Message.field) in options entries
- Update options entries in the same change that renames or removes fields
- Generate the field list from descriptors instead of hand-writing it
When it happens
Trigger: Registering options with opts.Field referencing a field that does not exist, is misspelled, is missing package/message qualification, or whose message lives in an unloaded file.
Common situations: Field renamed or removed from a message; qualifying only by message name without package; targeting a field inside a oneof/nested message with an incorrect path; options shared across repos with diverging schemas.
Related errors
- no file %s found
- no method %s found
- no message %s found
- no service %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/93f0d0a87bd9c3f3.
Report an issue: GitHub.