freqtrade/freqtrade · error · TemporaryError

Error in additional_exchange_init due to {e.__class__.__name

Error message

Error in additional_exchange_init due to {e.__class__.__name__}. Message: {e}

What it means

During Bybit startup, additional_exchange_init probes the account type via a private API call (detecting unified vs standard account) and ccxt raised OperationFailed/ExchangeError. Wrapped as TemporaryError, startup retries and eventually aborts. Usually an API-key/permission problem or a Bybit server-side rejection of the account-info query.

Source

Thrown at freqtrade/exchange/bybit.py:105

        try:
            if not self._config["dry_run"]:
                if self.trading_mode == TradingMode.FUTURES:
                    position_mode = self._api.set_position_mode(False)
                    self._log_exchange_response("set_position_mode", position_mode)
                is_unified = self._api.is_unified_enabled()
                # Returns a tuple of bools, first for margin, second for Account
                if is_unified and len(is_unified) > 1 and is_unified[1]:
                    self.unified_account = True
                    logger.info(
                        "Bybit: Unified account. Assuming dedicated subaccount for this bot."
                    )
                else:
                    self.unified_account = False
                    logger.info("Bybit: Standard account.")
        except ccxt.DDoSProtection as e:
            raise DDosProtection(e) from e
        except (ccxt.OperationFailed, ccxt.ExchangeError) as e:
            raise TemporaryError(
                f"Error in additional_exchange_init due to {e.__class__.__name__}. Message: {e}"
            ) from e
        except ccxt.BaseError as e:
            raise OperationalException(e) from e

    def _lev_prep(self, pair: str, leverage: float, side: BuySell, accept_fail: bool = False):
        if self.trading_mode != TradingMode.SPOT:
            params = {"leverage": leverage}
            self.set_margin_mode(pair, self.margin_mode, accept_fail=True, params=params)
            self._set_leverage(leverage, pair, accept_fail=True)

    def _get_params(
        self,
        side: BuySell,
        ordertype: str,
        leverage: float,
        reduceOnly: bool,
        time_in_force: str = "GTC",

View on GitHub (pinned to 1c8edfe4d1)

Solutions

  1. Verify the API key has read + trade permissions and the right product scope (Spot/Contract) on Bybit, and that the bot's IP is whitelisted.
  2. Update ccxt and freqtrade (pip install -U ccxt freqtrade) - Bybit endpoints change often.
  3. Check the Bybit status page for API incidents; retry startup after it clears.
  4. Confirm the account type (unified vs standard) in the Bybit app - init queries it and misconfigured subaccounts can reject the call.
Defensive patterns

Strategy: retry

Try / catch

from freqtrade.exceptions import TemporaryError

try:
    exchange = ExchangeResolver.load_exchange(config)
except TemporaryError as e:
    logger.error(f"Bybit init failed (check API permissions/status): {e}")
    raise SystemExit(1)

Prevention

When it happens

Trigger: Starting a live Bybit bot with API keys lacking the futures/contract permission or bound to the wrong account type; Bybit API incident; bot IP not whitelisted on the key; expired key; stale ccxt hitting a deprecated endpoint.

Common situations: New Bybit API keys created without 'Contract' permissions; keys restricted to an IP that changed; Bybit v5 migration quirks with old ccxt versions.

Related errors


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