{"record":{"id":"f8b405072acfe8aa","repo":"hyperledger/fabric","slug":"error-unmarshalling-original-config","errorCode":null,"errorMessage":"error unmarshalling original config","messagePattern":"error unmarshalling original config","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/configtxlator/main.go","lineNumber":202,"sourceCode":"\n\terr = protolator.DeepMarshalJSON(output, msg)\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"error encoding output\")\n\t}\n\n\treturn nil\n}\n\nfunc computeUpdt(original, updated, output *os.File, channelID string) error {\n\torigIn, err := io.ReadAll(original)\n\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","sourceCodeStart":184,"sourceCodeEnd":220,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/cmd/configtxlator/main.go#L184-L220","documentation":"proto.Unmarshal failed on the original config bytes: the data is not a valid wire-format common.Config message. The wrapper \"error unmarshalling original config\" distinguishes it from the updated-config equivalent.","triggerScenarios":"Original file is JSON instead of binary proto, was decoded/corrupted by a previous step, is truncated, or is a ConfigUpdate rather than a Config.","commonSituations":"Feeding config.json (output of decode) back into compute-update, partial downloads, or mixing artifacts from different Fabric channels/versions.","solutions":["Ensure both inputs are binary protos of type common.Config (re-run decode/encode pipeline correctly)","Validate with protoc --decode_raw < orig.pb","Re-fetch the original config from the orderer and decode/encode it cleanly","Check that the file wasn't edited or truncated"],"exampleFix":"// before\nconfigtxlator compute-update --original config.json --updated updated.json ...\n// after\nconfigtxlator encode --input config.json --output orig.pb --type common.Config && configtxlator encode --input updated.json --output updt.pb --type common.Config && configtxlator compute-update --original orig.pb --updated updt.pb ...","handlingStrategy":"validation","validationCode":"// verify original is binary common.Config, not JSON\nhead -c1 \"$ORIGINAL\" | grep -q '{' && echo \"original is JSON; encode it first\" && exit 1\nprotoc --decode_raw < \"$ORIGINAL\" > /dev/null || { echo \"invalid proto\"; exit 1; }","typeGuard":null,"tryCatchPattern":"out, err := cmd.CombinedOutput()\nif err != nil && strings.Contains(string(out), \"error unmarshalling original config\") {\n    return fmt.Errorf(\"re-encode original with: configtxlator encode --type common.Config\")\n}","preventionTips":["Always decode→edit→encode→compute-update in that order","Validate protos with protoc --decode_raw before diffing","Keep artifact provenance: same channel, same orderer fetch"],"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-08T15:18:49.778Z"}