Trading Error While exiting order

Getting While Exiting order getting Need Help on this -we picked the following pairs yesterday with specified ask and bid

[2026-03-18 09:32:01] to check pair :: WSM260320C00190000 + WSM260320P00175000 ask_call = 5 bid_call = 4.3 ask_put = 5.3 bid_put = 4.4

and routed the order :-

[2026-03-18 09:32:01] Order Payload :- [ {“order_class”:“mleg”,“type”:“limit”,“limit_price”:“10.300000”,“time_in_force”:“day”,“qty”:“1”,“legs”:[{“side”:“buy”,“position_intent”:“buy_to_open”,“symbol”:“WSM260320C00190000”,“ratio_qty”:“1”},{“side”:“buy”,“position_intent”:“buy_to_open”,“symbol”:“WSM260320P00175000”,“ratio_qty”:“1”}]} ]

and then we are exiting with the following JSON

[2026-03-18 09:32:54] Order Payload :- [ {“order_class”:“mleg”,“type”:“market”,“time_in_force”:“day”,“qty”:“1”,“legs”:[{“side”:“sell”,“position_intent”:“sell_to_close”,“symbol”:“WSM260320C00190000”,“ratio_qty”:“1”},{“side”:“sell”,“position_intent”:“sell_to_close”,“symbol”:“WSM260320P00175000”,“ratio_qty”:“1”}]} ]

However we are receiving

[2026-03-18 09:32:54] Order Response :- [ {“code”:50010000,“message”:“internal server error occurred”} ]

Nevertheless it did not happened for other order:-

[2026-03-18 09:32:00] Order Payload :- [ {“order_class”:“mleg”,“type”:“limit”,“limit_price”:“3.580000”,“time_in_force”:“day”,“qty”:“5”,“legs”:[{“side”:“buy”,“position_intent”:“buy_to_open”,“symbol”:“LULU260320C00170000”,“ratio_qty”:“1”},{“side”:“buy”,“position_intent”:“buy_to_open”,“symbol”:“LULU260320P00155000”,“ratio_qty”:“1”}]} ]
[2026-03-18 09:32:00]

and then onExit:-

we are sending :-

Order Payload :- [ {“order_class”:“mleg”,“type”:“market”,“time_in_force”:“day”,“qty”:“5”,“legs”:[{“side”:“sell”,“position_intent”:“sell_to_close”,“symbol”:“LULU260320C00170000”,“ratio_qty”:“1”},{“side”:“sell”,“position_intent”:“sell_to_close”,“symbol”:“LULU260320P00155000”,“ratio_qty”:“1”}]} ]

and we received :-

[2026-03-18 09:41:38] Order Response :- [ {“id”:“b1b38467-fbdf-43ee-8a4a-d4e2851500de”,“client_order_id”:“5b0836bd-9fcd-45b4-b0a3-557cc48c1079”,“created_at”:“2026-03-18T13:41:38.119178791Z”,“updated_at”:“2026-03-18T13:41:38.122188251Z”,“submitted_at”:“2026-03-18T13:41:38.119178791Z”,“filled_at”:null,“expired_at”:null,“canceled_at”:null,“failed_at”:null,“replaced_at”:null,“replaced_by”:null,“replaces”:null,“asset_id”:“”,“symbol”:“”,“asset_class”:“”,“notional”:null,“qty”:“5”,“filled_qty”:“0”,“filled_avg_price”:null,“order_class”:“mleg”,“order_type”:“market”,“type”:“market”,“side”:“”,“time_in_force”:“day”,“limit_price”:null,“stop_price”:null,“status”:“pending_new”,“extended_hours”:false,“legs”:[{“id”:“6ebe1163-054e-43d0-b1d2-2cf13cad1f9b”,“client_order_id”:“04d9459c-ff6f-449f-864d-ec048b68358a”,“created_at”:“2026-03-18T13:41:38.119178791Z”,“updated_at”:“2026-03-18T13:41:38.122195841Z”,“submitted_at”:“2026-03-18T13:41:38.119178791Z”,“filled_at”:null,“expired_at”:null,“canceled_at”:null,“failed_at”:null,“replaced_at”:null,“replaced_by”:null,“replaces”:null,“asset_id”:“59b0e1ef-77ab-48ee-8295-169b14767842”,“symbol”:“LULU260320C00170000”,“asset_class”:“us_option”,“notional”:null,“qty”:“5”,“filled_qty”:“0”,“filled_avg_price”:null,“order_class”:“mleg”,“order_type”:“market”,“type”:“market”,“side”:“sell”,“position_intent”:“sell_to_close”,“time_in_force”:“day”,“limit_price”:null,“stop_price”:null,“status”:“pending_new”,“extended_hours”:false,“legs”:null,“trail_percent”:null,“trail_price”:null,“hwm”:null,“subtag”:null,“source”:null,“expires_at”:“2026-03-18T20:00:00Z”,“ratio_qty”:“1”},{“id”:“b15c47c2-0acc-4dac-848c-afe2fc20ea23”,“client_order_id”:“108189fc-6fa6-423c-b81b-244d42100c09”,“created_at”:“2026-03-18T13:41:38.119178791Z”,“updated_at”:“2026-03-18T13:41:38.122230151Z”,“submitted_at”:“2026-03-18T13:41:38.119178791Z”,“filled_at”:null,“expired_at”:null,“canceled_at”:null,“failed_at”:null,“replaced_at”:null,“replaced_by”:null,“replaces”:null,“asset_id”:“f653a8a8-d62c-4185-ab71-52c2b23e239f”,“symbol”:“LULU260320P00155000”,“asset_class”:“us_option”,“notional”:null,“qty”:“5”,“filled_qty”:“0”,“filled_avg_price”:null,“order_class”:“mleg”,“order_type”:“market”,“type”:“market”,“side”:“sell”,“position_intent”:“sell_to_close”,“time_in_force”:“day”,“limit_price”:null,“stop_price”:null,“status”:“pending_new”,“extended_hours”:false,“legs”:null,“trail_percent”:null,“trail_price”:null,“hwm”:null,“subtag”:null,“source”:null,“expires_at”:“2026-03-18T20:00:00Z”,“ratio_qty”:“1”}],“trail_percent”:null,“trail_price”:null,“hwm”:null,“subtag”:null,“source”:null,“expires_at”:“2026-03-18T20:00:00Z”} ]

@shahayush I do agree that the error message “internal server error occurred” is not very helpful. That is a catch-all error when a process that the API calls gets confused or takes too long to respond. In this specific case, the problem was 1) you submitted a multi-leg market order, and 2) one of the specified symbols did not have a quote at the time. In that case, the API tries to calculate the required buying power, but since there are no quotes, it can’t do so. One or both of your contracts must not have had bid prices because that’s what your sell orders would have filled at. The reason there were no bid prices was because nobody was trying to buy. You cannot sell if that’s the case.

The workaround is to either ensure all your symbols have a current quote, but as a practical matter, it’s best to always submit option orders as limit orders. This avoids the need for a quote to calculate buying power, since that can be calculated from the limit prices. Moreover, options very frequently have large spreads, and you don’t want to get surprised with a fill much worse than you expected. Adding a limit will keep that from happening.

So, try submitting the same order, but as a limit order, and it should go through.