nautechsystems/nautilus_trader · error

target taker order {} is not owned by the account

Error message

target taker order {} is not owned by the account

What it means

When classifying a trade where the account acted as taker, the adapter checks that the trade's maker_address/owner attributes match the configured account credentials. This error means the taker-side trade record for the target order id is not owned by the configured account, so the fill cannot be attributed and reconciliation aborts.

Source

Thrown at crates/adapters/polymarket/src/execution/reconciliation.rs:866

            let order_side = validate_maker_order_side(trade, maker_order)?;
            validate_expected_order_side(
                expected_order_side,
                order_side,
                &format!("target maker order {}", maker_order.order_id),
            )?;
            (
                TargetFillParticipant::Maker {
                    maker_order,
                    identifiers,
                },
                instrument,
                maker_order.matched_amount,
                maker_order.price,
                format!("target maker order {} matched amount", maker_order.order_id),
                format!("target maker order {} price", maker_order.order_id),
            )
        } else {
            anyhow::ensure!(
                is_owned_by_account(
                    &trade.maker_address,
                    &trade.owner,
                    ctx.user_address,
                    ctx.api_key,
                ),
                "target taker order {} is not owned by the account",
                trade.taker_order_id,
            );
            let venue_order_id =
                checked_venue_order_id(&trade.taker_order_id, "target taker trade")?;
            let trade_id = checked_trade_id(&trade.id, "target taker trade")?;
            let instrument = resolve_target_instrument(
                instruments,
                trade.asset_id,
                instrument_id,
                &format!("target taker trade {}", trade.id),
            )?;

View on GitHub (pinned to 18893faf8b)

Solutions

  1. Verify ctx user_address and api_key match the account that executed the taker order; correct the adapter config.
  2. Restart the trading node after any credential change so FillContext is rebuilt.
  3. Query the provider for trades owned by your address to confirm the taker_order_id actually belongs to your account.
  4. If multiple accounts are in play, isolate reconciliation per account instead of sharing venue order ids across adapters.

Example fix

// before: taker trade attributed to another owner
// trade.owner = 0xDDDD..., ctx.user_address = 0xCCCC...
// after: configure adapter with the executing account
user_address = "0xDDDD..."
api_key = "<matching api key>"
Defensive patterns

Strategy: validation

Validate before calling

let trades = client.get_trades(&user_address).await?;
if !trades.iter().any(|t| t.taker_order_id == venue_order_id.as_str()
    && is_owned_by_account(&t.maker_address, &t.owner, &user_address, &api_key)) {
    return Err(anyhow!("taker trade for {venue_order_id} not owned by {user_address}"));
}

Type guard

fn taker_trade_owned(trade: &PolymarketTradeReport, ctx: &FillContext) -> bool {
    is_owned_by_account(&trade.maker_address, &trade.owner, ctx.user_address, ctx.api_key)
}

Try / catch

match result {
    Err(e) if e.to_string().contains("target taker order") && e.to_string().contains("not owned") => {
        log::error!("taker trade owned by another account; verify adapter user_address/api_key");
        // abort reconciliation for this trade; no retry
    }
    other => other?,
}

Prevention

When it happens

Trigger: Running fill reconciliation (build_fill_reports_from_trades -> classify_target_trade) on a trade where `trader_side != Maker` and `is_owned_by_account(&trade.maker_address, &trade.owner, ctx.user_address, ctx.api_key)` is false for `trade.taker_order_id`. Triggered by misconfigured user address/API key or the target order id resolving to a trade belonging to another account.

Common situations: Adapter configured with the wrong wallet/API credentials; switching accounts or API keys without restarting the trader; a duplicated or remapped venue order id colliding with another account's taker order in the fetched trades; importing trade history from a shared/sub-account.

Understand the failure class

Background: Permission denied / not authorized / 403 Forbidden: access-control rejections when the caller lacks the required role, grant, or ownership — this error's family across 18 libraries.

Related errors


AI-assisted analysis of nautechsystems/nautilus_trader@18893faf8b (2026-09-08). Data as JSON: /api/errors/c01f503e3b37b1b5. Report an issue: GitHub.