{"record":{"id":"ba57ab9333c738bb","repo":"grpc-ecosystem/grpc-gateway","slug":"no-enum-found-s","errorCode":null,"errorMessage":"no enum found: %s","messagePattern":"no enum found: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/descriptor/registry.go","lineNumber":387,"sourceCode":"\t\tfqmn := strings.Join(append(components, name), \".\")\n\t\tif m, ok := r.msgs[fqmn]; ok {\n\t\t\treturn m, nil\n\t\t}\n\t\tcomponents = components[:len(components)-1]\n\t}\n\treturn nil, fmt.Errorf(\"no message found: %s\", name)\n}\n\n// LookupEnum looks up an enum type by \"name\".\n// It tries to resolve \"name\" from \"location\" if \"name\" is a relative enum name.\nfunc (r *Registry) LookupEnum(location, name string) (*Enum, error) {\n\tif grpclog.V(1) {\n\t\tgrpclog.Infof(\"Lookup enum %s from %s\", name, location)\n\t}\n\tif strings.HasPrefix(name, \".\") {\n\t\te, ok := r.enums[name]\n\t\tif !ok {\n\t\t\treturn nil, fmt.Errorf(\"no enum found: %s\", name)\n\t\t}\n\t\treturn e, nil\n\t}\n\n\tif !strings.HasPrefix(location, \".\") {\n\t\tlocation = fmt.Sprintf(\".%s\", location)\n\t}\n\tcomponents := strings.Split(location, \".\")\n\tfor len(components) > 0 {\n\t\tfqen := strings.Join(append(components, name), \".\")\n\t\tif e, ok := r.enums[fqen]; ok {\n\t\t\treturn e, nil\n\t\t}\n\t\tcomponents = components[:len(components)-1]\n\t}\n\treturn nil, fmt.Errorf(\"no enum found: %s\", name)\n}\n","sourceCodeStart":369,"sourceCodeEnd":405,"githubUrl":"https://github.com/grpc-ecosystem/grpc-gateway/blob/a58a4436a376a4bcc7d8f10c4d4f919a8438bba9/internal/descriptor/registry.go#L369-L405","documentation":"Lookup-failure error from Registry.LookupEnum: no enum is registered under the fully-qualified name it tried to resolve (name given as .FQN when leading-dot, else resolved relative to location). Raised by the generic sentinel in the registry, the faulting input is an enum name reference in a proto/annotation that the registry has not loaded or that is misspelled.","triggerScenarios":"LookupEnum(location, '.example.hello.MyEnum') when the enum was never loaded (its proto file missing) or the FQMN is misspelled (wrong package/nesting).","commonSituations":"Annotations or query-parameter config referencing an enum from a proto not passed to the generator; enum moved into a message (nested), changing its fully-qualified name; package renames.","solutions":["Fix the enum name spelling/casing at the usage site.","Ensure the proto file defining the enum is included in the descriptor set passed to the plugin.","Use a fully-qualified (leading-dot) name if resolution from the location fails."],"exampleFix":"// before\nreg.LookupEnum(\".example.hello.Greeter\", \".example.hello.Status\")\n// after (enum nested in message)\nreg.LookupEnum(\".example.hello.Greeter\", \".example.hello.HelloReply.Status\")","handlingStrategy":"try-catch","validationCode":"func hasEnum(reg *Registry, fqen string) bool {\n    _, err := reg.LookupEnum(\".\", fqen)\n    return err == nil\n}","typeGuard":null,"tryCatchPattern":"e, err := reg.LookupEnum(loc, \".example.hello.Status\")\nif err != nil {\n    return fmt.Errorf(\"enum %s not registered: load its proto file: %w\", fqen, err)\n}","preventionTips":["Include nesting in the fully-qualified enum name (Msg.Enum)","Load all protos defining referenced enums","Update annotations after enum moves/renames","Verify enum FQMN with grpclog V(1) output"],"tags":["protobuf","registry","enum-lookup"],"backgroundTag":"message-not-found","analyzedSha":"a58a4436a376a4bcc7d8f10c4d4f919a8438bba9","analyzedAt":"2026-09-02T10:28:31.537Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T16:17:10.729Z"}