Skip to content

Unknown Order State

This page covers the "unknown order state" failure mode after place_order failures.

Cause

FYERS does not provide client idempotency keys. If a network timeout occurs, the order may or may not have been accepted.

Symptom

  • OrderUnknownStateError is raised.
  • The order id may be missing or only a request id is returned.

Resolution

  1. Check Order WS updates for the order id or request id.
  2. Call orderbook() to confirm if the order exists.
  3. Only retry once you have confirmed the order was not accepted.

What NOT To Do

  • Do not retry immediately.
  • Do not place a duplicate order to "fix" the state.

Scenario Example

Scenario: place_order returns a timeout and you see no WS updates. - Check orderbook() for recent orders. - If nothing is found, refresh token and retry once.