Why can't I place a stop limit order for an option position I hold?

I have long position for an option as in the position below:

When I try to place a stop limit “sell_to_close” order with the exact same qty, the API returns an error stating, I do not have enough cash in the account. Seems like it is treating the ‘sell’ as a standalone transaction, which is not true. How am I expected to submit such an order and exit the position when the stop is hit?

@dchitnis Verify you do not have an existing order which is trying to sell that same contract. That is probably why it thinks you were trying to sell short which is why it’s looking at buying power.

No, I don’t have an existing order. I simply have the position and I’m trying to place a sell_to_close intent order. Also, notice that the submit order works, but the order is being rejected right away. Hence I provided the order id so it can be diagnosed why it is being rejected. The returned object does not seem to have any explanation as to why the order is being rejected.