{"record":{"id":"fcaf27eacf7d78ca","repo":"freqtrade/freqtrade","slug":"max-open-trades-and-stake-amount-cannot-both-b","errorCode":null,"errorMessage":"`max_open_trades` and `stake_amount` cannot both be unlimited.","messagePattern":"`max_open_trades` and `stake_amount` cannot both be unlimited\\.","errorType":"exception","errorClass":"ConfigurationError","httpStatus":null,"severity":"error","filePath":"freqtrade/configuration/config_validation.py","lineNumber":110,"sourceCode":"    _validate_consumers(conf)\n    validate_migrated_strategy_settings(conf)\n    _validate_orderflow(conf)\n    _validate_demo_trading(conf)\n\n    # validate configuration before returning\n    logger.info(\"Validating configuration ...\")\n    validate_config_schema(conf, preliminary=preliminary)\n\n\ndef _validate_unlimited_amount(conf: dict[str, Any]) -> None:\n    \"\"\"\n    Either max_open_trades or stake_amount need to be set.\n    :raise: ConfigurationError if config validation failed\n    \"\"\"\n    if (\n        conf.get(\"max_open_trades\") == float(\"inf\") or conf.get(\"max_open_trades\") == -1\n    ) and conf.get(\"stake_amount\") == UNLIMITED_STAKE_AMOUNT:\n        raise ConfigurationError(\"`max_open_trades` and `stake_amount` cannot both be unlimited.\")\n\n\ndef _validate_price_config(conf: dict[str, Any]) -> None:\n    \"\"\"\n    When using market orders, price sides must be using the \"other\" side of the price\n    \"\"\"\n    if conf.get(\"order_types\", {}).get(\"entry\") == \"market\" and conf.get(\"entry_pricing\", {}).get(\n        \"price_side\"\n    ) not in (\"ask\", \"other\"):\n        raise ConfigurationError('Market entry orders require entry_pricing.price_side = \"other\".')\n\n    if conf.get(\"order_types\", {}).get(\"exit\") == \"market\" and conf.get(\"exit_pricing\", {}).get(\n        \"price_side\"\n    ) not in (\"bid\", \"other\"):\n        raise ConfigurationError('Market exit orders require exit_pricing.price_side = \"other\".')\n\n\ndef _validate_trailing_stoploss(conf: dict[str, Any]) -> None:","sourceCodeStart":92,"sourceCodeEnd":128,"githubUrl":"https://github.com/freqtrade/freqtrade/blob/1c8edfe4d1e8d11bd4b40e8fc3237c26c3a60e15/freqtrade/configuration/config_validation.py#L92-L128","documentation":"In _rpc_force_entry, when no trade exists for the pair but the count of open trades already meets config max_open_trades, entry is refused with 'Maximum number of trades is reached.' This mirrors the automatic entry path's slot limit for manual entries.","triggerScenarios":"max_open_trades=3 with 3 open trades and forceenter on a fresh pair; max_open_trades set low (e.g. 1) for testing; slots consumed by long-running positions.","commonSituations":"Test configs with max_open_trades=1; strong markets filling all slots then operator wants a manual position; raising max_open_trades in config but not restarting.","solutions":["Exit an existing trade to free a slot, then retry.","Raise max_open_trades in the active config and restart the bot.","Check /api/v1/count to confirm used vs max slots before forceentry."],"exampleFix":"# before: max_open_trades = 1, one trade open\nclient.post('/api/v1/forceenter', json={'pair': 'ETH/USDT'})  # max reached\n\n# after: free a slot or raise the limit (config)\n{ \"max_open_trades\": 3 }\n# then restart and retry","handlingStrategy":"validation","validationCode":"count = client.count()\nif count['current_max'] and count['count'] >= count['current_max']:\n    raise ValueError('All trade slots used; exit one or raise max_open_trades')","typeGuard":"def has_free_slot(count_resp: dict) -> bool:\n    return count_resp['count'] < count_resp['current_max']","tryCatchPattern":"from freqtrade.rpc import RPCException\ntry:\n    rpc._rpc_force_entry(pair, None)\nexcept RPCException as e:\n    if 'Maximum number of trades' in str(e):\n        client.forceexit('oldest')  # or surface to user to free a slot\n    else:\n        raise","preventionTips":["Poll /api/v1/count before manual entries.","Size max_open_trades to your capital so slots are not all locked by stale positions.","Restart the bot after changing max_open_trades — it is read at startup."],"tags":["freqtrade","forceentry","max-open-trades","capacity","config"],"backgroundTag":null,"analyzedSha":"1c8edfe4d1e8d11bd4b40e8fc3237c26c3a60e15","analyzedAt":"2026-08-15T05:09:08.096Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}