diff --git a/runtime/v2/services/autocli.go b/runtime/v2/services/autocli.go index 281d9f8c0301..85aeb20b702d 100644 --- a/runtime/v2/services/autocli.go +++ b/runtime/v2/services/autocli.go @@ -2,6 +2,7 @@ package services import ( "context" + "fmt" "github.com/cosmos/gogoproto/proto" "google.golang.org/grpc" @@ -104,11 +105,16 @@ type autocliRegistrar struct { func (a *autocliRegistrar) RegisterService(sd *grpc.ServiceDesc, ss interface{}) { if a.registryCache == nil { a.registryCache, a.err = proto.MergedRegistry() + if a.err != nil { + a.err = fmt.Errorf("failed to build registry cache: %w", a.err) + return + } } - desc, err := a.registryCache.FindDescriptorByName(protoreflect.FullName(sd.ServiceName)) + fullName := protoreflect.FullName(sd.ServiceName) + desc, err := a.registryCache.FindDescriptorByName(fullName) if err != nil { - a.err = err + a.err = fmt.Errorf("failed to find descriptor for %q: %w", fullName, err) return }