{"record":{"id":"34da9faaf93b49d6","repo":"hyperledger/fabric","slug":"malformed-block-contents-s","errorCode":null,"errorMessage":"malformed block contents: %s","messagePattern":"malformed block contents: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/configtxgen/main.go","lineNumber":93,"sourceCode":"\t}\n\treturn nil\n}\n\nfunc doInspectBlock(inspectBlock string) error {\n\tlogger.Info(\"Inspecting block\")\n\tdata, err := os.ReadFile(inspectBlock)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"could not read block %s\", inspectBlock)\n\t}\n\n\tlogger.Info(\"Parsing genesis block\")\n\tblock, err := protoutil.UnmarshalBlock(data)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error unmarshalling to block: %s\", err)\n\t}\n\terr = protolator.DeepMarshalJSON(os.Stdout, block)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"malformed block contents: %s\", err)\n\t}\n\treturn nil\n}\n\nfunc doInspectChannelCreateTx(inspectChannelCreateTx string) error {\n\tlogger.Info(\"Inspecting transaction\")\n\tdata, err := os.ReadFile(inspectChannelCreateTx)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"could not read channel create tx: %s\", err)\n\t}\n\n\tlogger.Info(\"Parsing transaction\")\n\tenv, err := protoutil.UnmarshalEnvelope(data)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"Error unmarshalling envelope: %s\", err)\n\t}\n\n\terr = protolator.DeepMarshalJSON(os.Stdout, env)","sourceCodeStart":75,"sourceCodeEnd":111,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/cmd/configtxgen/main.go#L75-L111","documentation":"Returned by doInspectBlock when protolator.DeepMarshalJSON fails while rendering the unmarshaled block as JSON to stdout. It means the block parsed as protobuf but its contents (e.g. malformed nested messages) could not be serialized into the human-readable JSON form configtxgen prints.","triggerScenarios":"Thrown at cmd/configtxgen/main.go:93 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the wrapped error to see which protobuf field failed conversion","Obtain a clean copy of the block from a peer or orderer and re-inspect"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}