{"record":{"id":"377b77f527066927","repo":"hyperledger/fabric","slug":"unmarshal-endorser-error-s","errorCode":null,"errorMessage":"Unmarshal endorser error: %s","messagePattern":"Unmarshal endorser error: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/handlers/validation/builtin/v12/validation_logic.go","lineNumber":792,"sourceCode":"\n\texists = true\n\treturn\n}\n\nfunc (vscc *Validator) deduplicateIdentity(cap *pb.ChaincodeActionPayload) ([]*protoutil.SignedData, error) {\n\t// this is the first part of the signed message\n\tprespBytes := cap.Action.ProposalResponsePayload\n\n\t// build the signature set for the evaluation\n\tsignatureSet := []*protoutil.SignedData{}\n\tsignatureMap := make(map[string]struct{})\n\t// loop through each of the endorsements and build the signature set\n\tfor _, endorsement := range cap.Action.Endorsements {\n\t\t// unmarshal endorser bytes\n\t\tserializedIdentity := &msp.SerializedIdentity{}\n\t\tif err := proto.Unmarshal(endorsement.Endorser, serializedIdentity); err != nil {\n\t\t\tlogger.Errorf(\"Unmarshal endorser error: %s\", err)\n\t\t\treturn nil, policyErr(fmt.Errorf(\"Unmarshal endorser error: %s\", err))\n\t\t}\n\t\tidentity := serializedIdentity.Mspid + string(serializedIdentity.IdBytes)\n\t\tif _, ok := signatureMap[identity]; ok {\n\t\t\t// Endorsement with the same identity has already been added\n\t\t\tlogger.Warningf(\"Ignoring duplicated identity, Mspid: %s, pem:\\n%s\", serializedIdentity.Mspid, serializedIdentity.IdBytes)\n\t\t\tcontinue\n\t\t}\n\t\tdata := make([]byte, len(prespBytes)+len(endorsement.Endorser))\n\t\tcopy(data, prespBytes)\n\t\tcopy(data[len(prespBytes):], endorsement.Endorser)\n\t\tsignatureSet = append(signatureSet, &protoutil.SignedData{\n\t\t\t// set the data that is signed; concatenation of proposal response bytes and endorser ID\n\t\t\tData: data,\n\t\t\t// set the identity that signs the message: it's the endorser\n\t\t\tIdentity: endorsement.Endorser,\n\t\t\t// set the signature\n\t\t\tSignature: endorsement.Signature,\n\t\t})","sourceCodeStart":774,"sourceCodeEnd":810,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/core/handlers/validation/builtin/v12/validation_logic.go#L774-L810","documentation":"Each endorsement contains a serialized MSP identity that must be proto-unmarshalable as msp.SerializedIdentity. VSCC's deduplication step rejects the whole transaction if any endorsement's Endorser bytes fail to unmarshal, indicating a malformed or corrupted endorsement.","triggerScenarios":"A proposal response endorsement whose Endorser field is not a valid protobuf msp.SerializedIdentity, encountered while building the signature set in deduplicateIdentity during validation.","commonSituations":"SDK misconfiguration placing non-identity bytes in the endorser field; corrupted proposal responses over the network; custom endorsers producing malformed identities; Fabric version/protobuf incompatibilities between SDK and peers.","solutions":["Regenerate the transaction with a current, properly configured Fabric SDK so endorsements contain valid serialized identities","Verify MSP configuration on all endorsing peers (valid certs, correct MSP IDs)","Upgrade SDK and peer to compatible versions so protobuf encodings match"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"const id = msp.SerializedIdentity.decode(endorsement.endorser_bytes);\nif (!id.mspid || !id.idBytes?.length) {\n  throw new Error('Endorsement endorser bytes are not a valid SerializedIdentity');\n}","typeGuard":"function isValidSerializedIdentity(buf) {\n  try {\n    const id = msp.SerializedIdentity.decode(buf);\n    return Boolean(id.mspid) && id.idBytes instanceof Uint8Array && id.idBytes.length > 0;\n  } catch { return false; }\n}","tryCatchPattern":"try {\n  await gateway.submit(transaction);\n} catch (e) {\n  if (String(e).includes('Unmarshal endorser error')) {\n    // rebuild the proposal with the official SDK; check MSP config\n  }\n}","preventionTips":["Use current official Fabric SDKs to assemble proposals","Keep peer MSP certs valid and correctly provisioned","Match SDK and peer protobuf/Fabric versions"],"tags":["hyperledger-fabric","vscc","endorsement","protobuf"],"backgroundTag":"malformed-endorsers-identity","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"}