freqtrade/freqtrade · error · RPCException

no active trade

Error message

no active trade

What it means

Error "no active trade" thrown in freqtrade/freqtrade.

Source

Thrown at freqtrade/rpc/rpc.py:207

                if config.get("max_entry_position_adjustment") != float("inf")
                else -1
            ),
        }
        return val

    def _rpc_trade_status(self, trade_ids: list[int] | None = None) -> list[dict[str, Any]]:
        """
        Below follows the RPC backend it is prefixed with rpc_ to raise awareness that it is
        a remotely exposed function
        """
        # Fetch open trades
        if trade_ids:
            trades: Sequence[Trade] = Trade.get_trades(trade_filter=Trade.id.in_(trade_ids)).all()
        else:
            trades = Trade.get_open_trades()

        if not trades:
            raise RPCException("no active trade")
        else:
            results = []
            for trade in trades:
                current_profit_fiat: float | None = None
                total_profit_fiat: float | None = None

                # prepare open orders details
                oo_details: str | None = ""
                oo_details_lst = [
                    f"({oo.order_type} {oo.side} rem={oo.safe_remaining:.8f})"
                    for oo in trade.open_orders
                    if oo.ft_order_side not in ["stoploss"]
                ]
                oo_details = ", ".join(oo_details_lst)

                total_profit_abs = 0.0
                total_profit_ratio: float | None = None
                # calculate profit and send message to user

View on GitHub (pinned to 1c8edfe4d1)

Solutions

  1. There is no open trade for the requested pair; open a trade first or query the status of open trades.
  2. Verify the pair has an active position before calling forceexit or trade-specific RPC commands.

Example fix

Check for an active trade first:
trade = Trade.get_open_trade()
if not trade:
    raise RPCException('no active trade')

When it happens

Trigger: Thrown at freqtrade/rpc/rpc.py:207 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of freqtrade/freqtrade@1c8edfe4d1 (2026-08-15). Data as JSON: /api/errors/ca521fe50ae35ea6. Report an issue: GitHub.