{"record":{"id":"5d708ba1cbda7134","repo":"hyperledger/fabric","slug":"message-of-type-s-unknown","errorCode":null,"errorMessage":"message of type %s unknown","messagePattern":"message of type (.+?) unknown","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/configtxlator/main.go","lineNumber":137,"sourceCode":"\t}\n\n\tapp.Fatalf(\"Error starting server:[%s]\\n\", err)\n}\n\nfunc printVersion() {\n\tfmt.Println(metadata.GetVersionInfo())\n}\n\nfunc encodeProto(msgName string, input, output *os.File) error {\n\tmt, err := protoregistry.GlobalTypes.FindMessageByName(protoreflect.FullName(msgName))\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"error encode input\")\n\t}\n\n\tmsgType := reflect.TypeOf(mt.Zero().Interface())\n\n\tif msgType == nil {\n\t\treturn errors.Errorf(\"message of type %s unknown\", msgType)\n\t}\n\tmsg := reflect.New(msgType.Elem()).Interface().(proto.Message)\n\n\terr = protolator.DeepUnmarshalJSON(input, msg)\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"error decoding input\")\n\t}\n\n\tif msg == nil {\n\t\treturn errors.New(\"error marshaling: proto: Marshal called with nil\")\n\t}\n\tout, err := proto.Marshal(msg)\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"error marshaling\")\n\t}\n\n\t_, err = output.Write(out)\n\tif err != nil {","sourceCodeStart":119,"sourceCodeEnd":155,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/cmd/configtxlator/main.go#L119-L155","documentation":"In `encodeProto` (cmd/configtxlator/main.go:137), the message type was resolved but `reflect.TypeOf(mt.Zero().Interface())` returned nil, so configtxlator cannot construct a concrete Go type for the message. This guard catches registry entries that do not yield a usable reflect.Type (effectively an impossible/unsupported type resolution).","triggerScenarios":"`configtxlator proto_encode --type <name>` where the registered message yields a nil Go type — practically hit only when the message name resolves in protoregistry but its generated Go type is unavailable (binary/tooling version mismatch).","commonSituations":"Mismatched fabric/fabric-protos versions in a custom-built configtxlator binary; a plugin-built binary missing generated message types; exotic dynamic message names.","solutions":["Rebuild/download a configtxlator binary that matches your Fabric and fabric-protos version.","Verify with a known-good type first (e.g. --type common.Config) to isolate whether the tool itself is broken.","If building from source, ensure the generated proto Go packages are imported so types are registered."],"exampleFix":"// before: custom-built binary missing proto registrations\n$ go build -o configtxlator ./cmd/configtxlator  // pruned imports -> type unknown\n// after: import the proto packages (or use official release)\nimport _ \"github.com/hyperledger/fabric-protos-go/common\"","handlingStrategy":"type-guard","validationCode":"// Sanity-check the tool first\n$ configtxlator proto_encode --type common.Config --input valid.json --output /tmp/t.pb || echo \"tool broken\"","typeGuard":"mt, err := protoregistry.GlobalTypes.FindMessageByName(protoreflect.FullName(msgName))\nif err != nil || mt == nil || reflect.TypeOf(mt.Zero().Interface()) == nil {\n\treturn fmt.Errorf(\"no usable Go type registered for %q\", msgName)\n}","tryCatchPattern":"out, err := exec.Command(\"configtxlator\", \"proto_encode\", \"--type\", msgType, ...).CombinedOutput()\nif err != nil && strings.Contains(string(out), \"message of type\") {\n\treturn fmt.Errorf(\"configtxlator build lacks type %s; use official release binary\", msgType)\n}","preventionTips":["Download configtxlator from official Fabric releases, not ad-hoc builds.","When building from source, import all needed fabric-protos-go packages so types register.","Smoke-test with common.Config before scripting bulk conversions.","Keep tooling version aligned with fabric-protos version."],"tags":["hyperledger-fabric","configtxlator","protobuf","reflection"],"backgroundTag":"unknown-proto-message-type","analyzedSha":"2736b63f8fd5932511d56fe68b7039d15977f7f6","analyzedAt":"2026-09-04T08:52:36.465Z","contentChangedAt":"2026-09-04T08:52:36.465Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}