{"record":{"id":"20875521519794e1","repo":"hyperledger/fabric","slug":"error-unmarshalling-updated-config","errorCode":null,"errorMessage":"error unmarshalling updated config","messagePattern":"error unmarshalling updated config","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/configtxlator/main.go","lineNumber":213,"sourceCode":"\tif err != nil {\n\t\treturn errors.Wrapf(err, \"error reading original config\")\n\t}\n\n\torigConf := &cb.Config{}\n\terr = proto.Unmarshal(origIn, origConf)\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"error unmarshalling original config\")\n\t}\n\n\tupdtIn, err := io.ReadAll(updated)\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"error reading updated config\")\n\t}\n\n\tupdtConf := &cb.Config{}\n\terr = proto.Unmarshal(updtIn, updtConf)\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"error unmarshalling updated config\")\n\t}\n\n\tcu, err := update.Compute(origConf, updtConf)\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"error computing config update\")\n\t}\n\n\tcu.ChannelId = channelID\n\n\toutBytes, err := proto.Marshal(cu)\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"error marshaling computed config update\")\n\t}\n\n\t_, err = output.Write(outBytes)\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"error writing config update to output\")\n\t}","sourceCodeStart":195,"sourceCodeEnd":231,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/cmd/configtxlator/main.go#L195-L231","documentation":"Returned by computeUpdt in configtxlator when proto.Unmarshal fails to decode the updated config bytes into a common.Config. The updated input was read but is not valid protobuf or not a Config message, so no config update can be computed against it.","triggerScenarios":"Updated file is still JSON (encode step skipped or failed), contains a ConfigUpdate instead of Config, or is corrupted/truncated after manual edits.","commonSituations":"Editing config.json, forgetting to re-encode with configtxlator encode before compute-update; version mismatches in fabric-protos; partial writes.","solutions":["Encode the edited JSON back to binary: configtxlator encode --type common.Config before compute-update","Validate the file with protoc --decode_raw","Ensure the updated input is a full common.Config, not a ConfigUpdate","Recreate the file if truncated or hand-edited"],"exampleFix":"// before\nconfigtxlator compute-update --original orig.pb --updated updated.json ...\n// after\nconfigtxlator encode --input updated.json --output updt.pb --type common.Config && configtxlator compute-update --original orig.pb --updated updt.pb ...","handlingStrategy":"validation","validationCode":"head -c1 \"$UPDATED\" | grep -q '{' && echo \"updated is JSON; run configtxlator encode first\" && exit 1\nprotoc --decode_raw < \"$UPDATED\" > /dev/null || { echo \"invalid proto\"; exit 1; }","typeGuard":null,"tryCatchPattern":"out, err := cmd.CombinedOutput()\nif err != nil && strings.Contains(string(out), \"error unmarshalling updated config\") {\n    return fmt.Errorf(\"encode edited JSON to binary before compute-update: %w\", err)\n}","preventionTips":["Never pass JSON directly to compute-update","Re-encode after every manual edit","Confirm the file is common.Config, not ConfigUpdate"],"tags":["protobuf","unmarshal","configtxlator","fabric"],"backgroundTag":"protobuf-unmarshal-failed","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"}