{"record":{"id":"f197c8663bcf9a2f","repo":"hyperledger/fabric","slug":"got-unexpected-status-v-s","errorCode":null,"errorMessage":"got unexpected status: %v -- %s","messagePattern":"got unexpected status: (.+?) -- (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/peer/common/broadcastclient.go","lineNumber":44,"sourceCode":"\toc, err := NewOrdererClientFromEnv()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tbc, err := oc.Broadcast()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn &BroadcastGRPCClient{Client: bc}, nil\n}\n\nfunc (s *BroadcastGRPCClient) getAck() error {\n\tmsg, err := s.Client.Recv()\n\tif err != nil {\n\t\treturn err\n\t}\n\tif msg.Status != cb.Status_SUCCESS {\n\t\treturn errors.Errorf(\"got unexpected status: %v -- %s\", msg.Status, msg.Info)\n\t}\n\treturn nil\n}\n\n// Send data to orderer\nfunc (s *BroadcastGRPCClient) Send(env *cb.Envelope) error {\n\tif err := s.Client.Send(env); err != nil {\n\t\treturn errors.WithMessage(err, \"could not send to orderer node\")\n\t}\n\n\terr := s.getAck()\n\n\treturn err\n}\n\nfunc (s *BroadcastGRPCClient) Close() error {\n\treturn s.Client.CloseSend()\n}","sourceCodeStart":26,"sourceCodeEnd":62,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/internal/peer/common/broadcastclient.go#L26-L62","documentation":"getAck reads the broadcast stream response from the orderer; if the returned status is anything other than SUCCESS, it raises this error carrying the cb.Status enum and the orderer-provided info string. It means the orderer explicitly rejected the submitted envelope rather than a transport failure.","triggerScenarios":"Submitting a transaction/config envelope via BroadcastGRPCClient.Send and the orderer replies with a non-SUCCESS status such as BAD_REQUEST, FORBIDDEN, SERVICE_UNAVAILABLE, or NOT_READY, with msg.Info describing the cause.","commonSituations":"Orderer cluster has no leader (SERVICE_UNAVAILABLE); channel does not exist (BAD_REQUEST); the submitting client lacks write permission (FORBIDDEN); config update validation failure during channel update; submitting to wrong channel's orderer.","solutions":["Read the msg.Info text after the '--' for the orderer's specific rejection reason","Check orderer logs (e.g. raft leader availability, channel existence) for the matching error","If SERVICE_UNAVAILABLE, wait for/order the raft leader election to complete and retry","If FORBIDDEN, fix the client's MSP/certificates so it has write access to the channel","If BAD_REQUEST on channel update, re-validate the config update envelope against current config"],"exampleFix":"// before\nerr = broadcastClient.Send(env) // got unexpected status: SERVICE_UNAVAILABLE -- no leader\n// after\n// check orderer raft status first, then retry\nif status == cb.Status_SERVICE_UNAVAILABLE { time.Sleep(2 * time.Second); err = broadcastClient.Send(env) }","handlingStrategy":"retry","validationCode":"// verify channel exists and client can write before sending\nresp, err := cf.ChannelClient.GetChannelInfo()\nif err != nil { return fmt.Errorf(\"channel %s not reachable: %w\", channelID, err) }","typeGuard":"func isOrdererStatusError(err error) bool {\n    return err != nil && strings.Contains(err.Error(), \"got unexpected status:\")\n}","tryCatchPattern":"if err := broadcastClient.Send(env); err != nil {\n    if strings.Contains(err.Error(), \"SERVICE_UNAVAILABLE\") {\n        return retryWithBackoff(func() error { return broadcastClient.Send(env) })\n    }\n    log.Errorf(\"orderer rejected envelope: %v\", err) // inspect status + info after '--'\n    return err\n}","preventionTips":["Monitor orderer raft leader availability before submitting transactions","Confirm the client's MSP certs grant write access to the target channel","Validate config update envelopes against current channel config before submitting","Point the submit at an orderer that serves the target channel"],"tags":["orderer","grpc","consensus","hyperledger-fabric"],"backgroundTag":"orderer-rejected-transaction","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"}