hyperledger/fabric · error
error unmarshalling original config
Error message
error unmarshalling original config
What it means
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.
Source
Thrown at cmd/configtxlator/main.go:202
err = protolator.DeepMarshalJSON(output, msg)
if err != nil {
return errors.Wrapf(err, "error encoding output")
}
return nil
}
func computeUpdt(original, updated, output *os.File, channelID string) error {
origIn, err := io.ReadAll(original)
if err != nil {
return errors.Wrapf(err, "error reading original config")
}
origConf := &cb.Config{}
err = proto.Unmarshal(origIn, origConf)
if err != nil {
return errors.Wrapf(err, "error unmarshalling original config")
}
updtIn, err := io.ReadAll(updated)
if err != nil {
return errors.Wrapf(err, "error reading updated config")
}
updtConf := &cb.Config{}
err = proto.Unmarshal(updtIn, updtConf)
if err != nil {
return errors.Wrapf(err, "error unmarshalling updated config")
}
cu, err := update.Compute(origConf, updtConf)
if err != nil {
return errors.Wrapf(err, "error computing config update")
}
View on GitHub (pinned to 2736b63f8f)
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
Example fix
// before configtxlator compute-update --original config.json --updated updated.json ... // after configtxlator 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 ...
Defensive patterns
Strategy: validation
Validate before calling
// verify original is binary common.Config, not JSON
head -c1 "$ORIGINAL" | grep -q '{' && echo "original is JSON; encode it first" && exit 1
protoc --decode_raw < "$ORIGINAL" > /dev/null || { echo "invalid proto"; exit 1; } Try / catch
out, err := cmd.CombinedOutput()
if err != nil && strings.Contains(string(out), "error unmarshalling original config") {
return fmt.Errorf("re-encode original with: configtxlator encode --type common.Config")
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: Feeding config.json (output of decode) back into compute-update, partial downloads, or mixing artifacts from different Fabric channels/versions.
Understand the failure class
Background: "cannot parse invalid wire-format data", "cannot unmarshal", "failed unmarshalling": protobuf unmarshal errors explained — this error's family across 10 libraries.
Related errors
- error unmarshalling
- error unmarshalling updated config
- error encoding output
- failed to unmarshal ApplicationPolicy bytes
- could not unmarshal signature policy envelope
AI-assisted analysis of hyperledger/fabric@2736b63f8f (2026-09-04).
Data as JSON: /api/errors/f8b405072acfe8aa.
Report an issue: GitHub.