{"record":{"id":"6add718f36ed903a","repo":"freqtrade/freqtrade","slug":"error-in-additional-exchange-init-due-to-e-clas-6add71","errorCode":null,"errorMessage":"Error in additional_exchange_init due to {e.__class__.__name__}. Message: {e}","messagePattern":"Error in additional_exchange_init due to (.+?)\\. Message: (.+?)","errorType":"exception","errorClass":"TemporaryError","httpStatus":null,"severity":"error","filePath":"freqtrade/exchange/bybit.py","lineNumber":105,"sourceCode":"        try:\n            if not self._config[\"dry_run\"]:\n                if self.trading_mode == TradingMode.FUTURES:\n                    position_mode = self._api.set_position_mode(False)\n                    self._log_exchange_response(\"set_position_mode\", position_mode)\n                is_unified = self._api.is_unified_enabled()\n                # Returns a tuple of bools, first for margin, second for Account\n                if is_unified and len(is_unified) > 1 and is_unified[1]:\n                    self.unified_account = True\n                    logger.info(\n                        \"Bybit: Unified account. Assuming dedicated subaccount for this bot.\"\n                    )\n                else:\n                    self.unified_account = False\n                    logger.info(\"Bybit: Standard account.\")\n        except ccxt.DDoSProtection as e:\n            raise DDosProtection(e) from e\n        except (ccxt.OperationFailed, ccxt.ExchangeError) as e:\n            raise TemporaryError(\n                f\"Error in additional_exchange_init due to {e.__class__.__name__}. Message: {e}\"\n            ) from e\n        except ccxt.BaseError as e:\n            raise OperationalException(e) from e\n\n    def _lev_prep(self, pair: str, leverage: float, side: BuySell, accept_fail: bool = False):\n        if self.trading_mode != TradingMode.SPOT:\n            params = {\"leverage\": leverage}\n            self.set_margin_mode(pair, self.margin_mode, accept_fail=True, params=params)\n            self._set_leverage(leverage, pair, accept_fail=True)\n\n    def _get_params(\n        self,\n        side: BuySell,\n        ordertype: str,\n        leverage: float,\n        reduceOnly: bool,\n        time_in_force: str = \"GTC\",","sourceCodeStart":87,"sourceCodeEnd":123,"githubUrl":"https://github.com/freqtrade/freqtrade/blob/1c8edfe4d1e8d11bd4b40e8fc3237c26c3a60e15/freqtrade/exchange/bybit.py#L87-L123","documentation":"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.","triggerScenarios":"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.","commonSituations":"New Bybit API keys created without 'Contract' permissions; keys restricted to an IP that changed; Bybit v5 migration quirks with old ccxt versions.","solutions":["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.","Update ccxt and freqtrade (pip install -U ccxt freqtrade) - Bybit endpoints change often.","Check the Bybit status page for API incidents; retry startup after it clears.","Confirm the account type (unified vs standard) in the Bybit app - init queries it and misconfigured subaccounts can reject the call."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"from freqtrade.exceptions import TemporaryError\n\ntry:\n    exchange = ExchangeResolver.load_exchange(config)\nexcept TemporaryError as e:\n    logger.error(f\"Bybit init failed (check API permissions/status): {e}\")\n    raise SystemExit(1)","preventionTips":["Grant API keys all needed product permissions at creation.","Whitelist a stable (static) IP for the bot.","Keep ccxt updated; Bybit API v5 changes break old mappings."],"tags":["bybit","ccxt","startup","api-key","permissions"],"backgroundTag":null,"analyzedSha":"1c8edfe4d1e8d11bd4b40e8fc3237c26c3a60e15","analyzedAt":"2026-08-15T05:09:08.096Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}