hyperledger/fabric · error
expected QueryResult of either ConfigResult or Error but got
Error message
expected QueryResult of either ConfigResult or Error but got %v instead
What it means
mapConfig indexed a discovery response result that is neither a ConfigResult nor an Error payload — the peer returned an unexpected QueryResult oneof variant for a config query, indicating a version/protocol mismatch with the discovery service.
Source
Thrown at discovery/client/client.go:368
err = resp.mapEndorsers(channel2index, r, req.invocationChainMapping)
case protoext.PeerMembershipQueryType:
err = resp.mapPeerMembership(channel2index, r, protoext.PeerMembershipQueryType)
case protoext.LocalMembershipQueryType:
err = resp.mapPeerMembership(channel2index, r, protoext.LocalMembershipQueryType)
}
if err != nil {
return nil, err
}
}
return resp, err
}
func (resp response) mapConfig(channel2index map[string]int, r *discovery.Response) error {
for ch, index := range channel2index {
config, err := protoext.ResponseConfigAt(r, index)
if config == nil && err == nil {
return errors.Errorf("expected QueryResult of either ConfigResult or Error but got %v instead", r.Results[index])
}
key := key{
queryType: protoext.ConfigQueryType,
k: ch,
}
if err != nil {
resp[key] = errors.New(err.Content)
continue
}
resp[key] = config
}
return nil
}
func (resp response) mapPeerMembership(key2Index map[string]int, r *discovery.Response, qt protoext.QueryType) error {
for k, index := range key2Index {View on GitHub (pinned to 2736b63f8f)
Solutions
- Use a discovery client version matching the peer's discovery service
- Inspect r.Results[index] to identify the unexpected variant
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at discovery/client/client.go:368 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of hyperledger/fabric@2736b63f8f (2026-09-04).
Data as JSON: /api/errors/abce0b4985638aab.
Report an issue: GitHub.