hyperledger/fabric · error
failed parsing request
Error message
failed parsing request
What it means
This error wraps any failure from protoext.SignedRequestToRequest while converting the signed protobuf payload into a *discovery.Request. It indicates the request bytes are not a parseable SignedRequest — malformed payload, empty payload, or invalid protobuf encoding — so the service cannot proceed to authentication.
Source
Thrown at discovery/service.go:239
continue
}
peersForCurrentOrg[string(id.PKIId)] = &discovery.Peer{
Identity: id.Identity,
MembershipInfo: aliveInfo.Envelope,
}
}
}
return peersByOrg
}
// validateStructure validates that the request contains all the needed fields and that they are computed correctly
func validateStructure(ctx context.Context, request *discovery.SignedRequest, tlsEnabled bool, certHashFromContext certHashExtractor) (*discovery.Request, error) {
if request == nil {
return nil, errors.New("nil request")
}
req, err := protoext.SignedRequestToRequest(request)
if err != nil {
return nil, errors.Wrap(err, "failed parsing request")
}
if req.Authentication == nil {
return nil, errors.New("access denied, no authentication info in request")
}
if len(req.Authentication.ClientIdentity) == 0 {
return nil, errors.New("access denied, client identity wasn't supplied")
}
if !tlsEnabled {
return req, nil
}
computedHash := certHashFromContext(ctx)
if len(computedHash) == 0 {
return nil, errors.New("client didn't send a TLS certificate")
}
if !bytes.Equal(computedHash, req.Authentication.ClientTlsCertHash) {
claimed := hex.EncodeToString(req.Authentication.ClientTlsCertHash)
logger.Warningf("client claimed TLS hash %s doesn't match computed TLS hash from gRPC stream %s", claimed, hex.EncodeToString(computedHash))
return nil, errors.New("client claimed TLS hash doesn't match computed TLS hash from gRPC stream")View on GitHub (pinned to 2736b63f8f)
Solutions
- Build the request with the official discovery client/SDK (dis.NewRequest ... Sign) instead of manually serializing
- Check the server log for the wrapped root error detailing why SignedRequestToRequest failed
- Ensure SDK and Fabric peer proto versions are compatible (fabric-protos mismatch)
- Regenerate/rebuild generated protobuf code if you customized the client serialization
- Capture the outgoing payload and verify it decodes as a discovery.SignedRequest with protoc
Example fix
// before
payload := []byte("manual request")
req := &discovery.SignedRequest{Payload: payload} // not valid protobuf
// after
r := discovery.NewRequest().AddQueryToConfigQuery()
r.Authentication.ClientIdentity = identity
payload, err := proto.Marshal(r.ToRequest()) // serialize the real message
if err != nil { return err }
req := &discovery.SignedRequest{Payload: payload, Signature: sig} Defensive patterns
Strategy: validation
Validate before calling
payload := signedReq.GetPayload()
if len(payload) == 0 {
return errors.New("discovery: request payload empty; will fail server-side parsing")
}
var chk discovery.Request
if err := proto.Unmarshal(payload, &chk); err != nil {
return fmt.Errorf("discovery: payload is not a valid Request: %w", err)
} Try / catch
resp, err := client.Send(ctx, signedReq)
if err != nil {
if strings.Contains(err.Error(), "failed parsing request") {
// rebuild request from scratch and retry once
return rebuildAndSend(ctx)
}
return nil, err
} Prevention
- Serialize with the same fabric-protos version used by the peer
- Never hand-build request bytes; use discovery.NewRequest() and Sign
- Keep SDK and peer releases in sync
- Add a smoke test that sends a real signed request in CI
When it happens
Trigger: A client sends a SignedRequest whose payload fails protobuf unmarshaling: empty payload bytes, corrupted/truncated serialization, or a payload that is not the expected discovery SignedRequest message type.
Common situations: Hand-crafting the request bytes instead of using the SDK; mixing incompatible Fabric SDK/proto versions so wire formats differ; network middleware mangling the body; sending a different protobuf message to the discovery endpoint.
Related errors
- failed to deserialize values
- failed unmarshalling peer's identity
- Failed unmarshalling GossipMessage from envelope: %v
- Cannot read channels list response, %s
- channel header unmarshalling error: %s
AI-assisted analysis of hyperledger/fabric@2736b63f8f (2026-09-04).
Data as JSON: /api/errors/d597d14cdc45ac98.
Report an issue: GitHub.