{"record":{"id":"77db5ec3e80242a8","repo":"nautechsystems/nautilus_trader","slug":"submit-order-rejected-reason","errorCode":null,"errorMessage":"submit order rejected: {reason}","messagePattern":"submit order rejected: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/bybit/src/execution.rs","lineNumber":1411,"sourceCode":"                        smp_type,\n                        native_tp_sl_ref,\n                    )\n                    .await;\n\n                if let Err(e) = result {\n                    if let Some(reason) = submit_rejection_reason(&e) {\n                        dispatch_state.order_identities.remove(&client_order_id);\n                        dispatch_state.order_snapshots.remove(&client_order_id);\n                        let ts_event = clock.get_time_ns();\n                        emitter.emit_order_rejected_event(\n                            strategy_id,\n                            instrument_id,\n                            client_order_id,\n                            reason,\n                            ts_event,\n                            bybit_rejection_due_post_only(reason),\n                        );\n                        anyhow::bail!(\"submit order rejected: {reason}\");\n                    }\n\n                    log::warn!(\n                        \"Submit failure without confirmed venue rejection for {client_order_id}: \\\n                         {e}; awaiting reconciliation\",\n                    );\n                    return Ok(());\n                }\n\n                Ok(())\n            });\n\n            return Ok(());\n        }\n\n        let raw_symbol = extract_raw_symbol(instrument_id.symbol.as_str());\n        let params = Self::build_ws_place_params(\n            &order,","sourceCodeStart":1393,"sourceCodeEnd":1429,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/bybit/src/execution.rs#L1393-L1429","documentation":"Raised when a submit-order request reaches Bybit but the venue rejects it, or the request fails with a confirmed rejection reason. The adapter emits an OrderRejected event (flagging post-only rejections) and then fails the submit_order call with the venue's reason.","triggerScenarios":"Calling submit_order when Bybit responds with a rejection reason — e.g. insufficient balance, post-only would cross the book, invalid price/qty filters, or order already exists.","commonSituations":"Post-only limit orders that would immediately execute; order sizes below the venue's min notional/qty; price outside allowed bounds; trading a symbol while the account lacks funds or permissions.","solutions":["Read the rejection reason in the error/OrderRejected event and correct the order parameters","Check account balance and symbol filters (min qty, tick size, notional) before submitting","Avoid postOnly for orders likely to cross, or handle post-only rejections with re-pricing/retry logic","Verify the instrument is tradeable and the API key has trading permissions"],"exampleFix":"// before\nclient.submit_order(post_only_limit_that_crosses)?; // bail: submit order rejected\n// after\nmatch client.submit_order(order) {\n    Err(e) if bybit_rejection_due_post_only(&e) => {\n        let taker = order.as_limit().set_post_only(false);\n        client.submit_order(taker)?;\n    }\n    result => result?,\n}","handlingStrategy":"try-catch","validationCode":"let instrument = cache.instrument(&order.instrument_id()).unwrap();\nlet price = order.as_limit().price();\nlet qty = order.quantity();\nassert!(qty >= instrument.min_quantity().unwrap(), \"qty below min\");\nassert!(price % instrument.tick_size() == 0.0, \"price off tick size\");\n// check balance >= qty * price for buys before submitting","typeGuard":null,"tryCatchPattern":"match exec_client.submit_order(order) {\n    Err(e) if e.to_string().starts_with(\"submit order rejected:\") => {\n        let reason = e.to_string();\n        if reason.contains(\"post-only\") {\n            // re-price as taker or drop the order\n        } else {\n            // handle balance/filter rejections\n        }\n    }\n    r => r?,\n}","preventionTips":["Validate price/qty against the instrument's filters before submit","Keep sufficient balance buffer for buy orders","Handle post-only rejections with re-pricing logic","Confirm trading permissions on the API key"],"tags":["bybit","order-rejected","submit-order","venue-rejection"],"backgroundTag":"http-error-response","analyzedSha":"18893faf8b356be3320add8de2f861b0b647cf06","analyzedAt":"2026-09-08T20:49:34.690Z","contentChangedAt":"2026-09-08T20:49:34.690Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}