{"record":{"id":"a740028fae833eca","repo":"hyperledger/fabric","slug":"failed-to-submit-request","errorCode":null,"errorMessage":"failed to submit request","messagePattern":"failed to submit request","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"orderer/consensus/smartbft/chain.go","lineNumber":323,"sourceCode":"func (c *BFTChain) pruneBadRequests() {\n\tc.consensus.Pool.Prune(func(req []byte) error {\n\t\t_, err := c.consensus.Verifier.VerifyRequest(req)\n\t\treturn err\n\t})\n}\n\nfunc (c *BFTChain) submit(env *cb.Envelope) error {\n\tif env == nil {\n\t\treturn errors.New(\"failed to marshal request envelope: proto: Marshal called with nil\")\n\t}\n\treqBytes, err := proto.Marshal(env)\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"failed to marshal request envelope\")\n\t}\n\n\tc.Logger.Debugf(\"Consensus.SubmitRequest, node id %d\", c.Config.SelfID)\n\tif err = c.consensus.SubmitRequest(reqBytes); err != nil {\n\t\treturn errors.Wrapf(err, \"failed to submit request\")\n\t}\n\treturn nil\n}\n\n// Order accepts a message which has been processed at a given configSeq.\n// If the configSeq advances, it is the responsibility of the consenter\n// to revalidate and potentially discard the message\n// The consenter may return an error, indicating the message was not accepted\nfunc (c *BFTChain) Order(env *cb.Envelope, configSeq uint64) error {\n\tseq := c.support.Sequence()\n\tif configSeq < seq {\n\t\tc.Logger.Warnf(\"Normal message was validated against %d, although current config seq has advanced (%d)\", configSeq, seq)\n\t\tif _, err := c.support.ProcessNormalMsg(env); err != nil {\n\t\t\treturn errors.Errorf(\"bad normal message: %s\", err)\n\t\t}\n\t}\n\n\treturn c.submit(env)","sourceCodeStart":305,"sourceCodeEnd":341,"githubUrl":"https://github.com/hyperledger/fabric/blob/2736b63f8fd5932511d56fe68b7039d15977f7f6/orderer/consensus/smartbft/chain.go#L305-L341","documentation":"This error is returned by BFTChain.submit when c.consensus.SubmitRequest(reqBytes) rejects the marshaled request, wrapping the underlying consensus error. It means the SmartBFT engine itself refused to enqueue the request — typically because the node is not the leader, is catching up, or the internal consensus queue is unavailable/closed.","triggerScenarios":"Calling Order() or Configure() after the BFT chain has started but the underlying consensus instance fails SubmitRequest — e.g. the node just lost leadership, the chain is being halted, view-change in progress, or the request queue is full.","commonSituations":"Leader failover/view change while clients keep broadcasting; ordering node being shut down mid-traffic; requests arriving before the chain finished starting; consensus internals wedged after network partition.","solutions":["Inspect the wrapped error from SubmitRequest to see the exact consensus failure reason","Retry the broadcast after a short delay — during view change/leader failover requests are transiently rejected","Verify the node's BFT config (SelfID, cluster membership) matches other nodes so leadership elections succeed","Check chain halt/shutdown ordering in your code; do not submit after Chain.Start errors or during Close"],"exampleFix":"// before\nif err := chain.Order(env, seq); err != nil { return err } // failed to submit request\n\n// after\nvar err error\nfor i := 0; i < 3; i++ {\n    if err = chain.Order(env, seq); err == nil || !strings.Contains(err.Error(), \"failed to submit request\") { break }\n    time.Sleep(500 * time.Millisecond)\n}","handlingStrategy":"retry","validationCode":"// Pre-flight: ensure chain is running and node is active before submitting\nif !chainStarted.Load() { return errors.New(\"chain not started\") }\n// Optionally skip submit when this node is known to be mid-view-change\nif consensusState() == StateViewChange { return errors.New(\"view change in progress, retry later\") }","typeGuard":null,"tryCatchPattern":"var err error\nfor i := 0; i < 5; i++ {\n    if err = chain.Order(env, seq); err == nil { return nil }\n    if !strings.Contains(err.Error(), \"failed to submit request\") { return err }\n    time.Sleep(time.Duration(1<<i) * 100 * time.Millisecond)\n}\nreturn err","preventionTips":["Implement exponential backoff around Order/Configure for transient consensus rejections","Monitor BFT leadership/view-change metrics and pause submits during failover","Never submit after chain shutdown/Close has begun","Keep cluster membership config consistent so elections complete quickly"],"tags":["consensus","smartbft","orderer","leader-election"],"backgroundTag":"consensus-submit-rejected","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"}