{"record":{"id":"58f62d16ca3771a0","repo":"Fosowl/agenticSeek","slug":"minimax-api-error-str-e","errorCode":null,"errorMessage":"MiniMax API error: {str(e)}","messagePattern":"MiniMax API error: (.+?)","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"sources/llm_provider.py","lineNumber":471,"sourceCode":"        base_url = os.getenv(\"MINIMAX_BASE_URL\", \"https://api.minimax.io/v1\")\n\n        client = OpenAI(api_key=self.api_key, base_url=base_url)\n        if self.is_local:\n            raise Exception(\"MiniMax is not available for local use. Change config.ini\")\n        try:\n            response = client.chat.completions.create(\n                model=self.model,\n                messages=history,\n                temperature=1.0,\n            )\n            if response is None:\n                raise Exception(\"MiniMax response is empty.\")\n            thought = response.choices[0].message.content\n            if verbose:\n                print(thought)\n            return thought\n        except Exception as e:\n            raise Exception(f\"MiniMax API error: {str(e)}\") from e\n\n    def dsk_deepseek(self, history, verbose=False):\n        \"\"\"\n        Use: xtekky/deepseek4free\n        For free api. Api key should be set to DSK_DEEPSEEK_API_KEY\n        This is an unofficial provider, you'll have to find how to set it up yourself.\n        \"\"\"\n        from dsk.api import (\n            DeepSeekAPI,\n            AuthenticationError,\n            RateLimitError,\n            NetworkError,\n            CloudflareError,\n            APIError\n        )\n        thought = \"\"\n        message = '\\n---\\n'.join([f\"{msg['role']}: {msg['content']}\" for msg in history])\n","sourceCodeStart":453,"sourceCodeEnd":489,"githubUrl":"https://github.com/Fosowl/agenticSeek/blob/ae57a2357745a9706cb12d0fd76d954c84d166fa/sources/llm_provider.py#L453-L489","documentation":"The catch-all in minimax_fn: every exception inside the try block — OpenAI SDK HTTP errors (401/429/5xx), connection failures, and the internal 'MiniMax response is empty.' raise — is re-wrapped as 'MiniMax API error: <details>' with the original exception chained via 'from e'.","triggerScenarios":"Any failure during the MiniMax chat completion call: invalid API key, wrong base URL, network error, rate limit, unsupported model, or the None-response guard firing.","commonSituations":"Missing/expired MINIMAX_API_KEY; MINIMAX_BASE_URL misconfigured (wrong region/legacy domain); firewall blocking api.minimax.io; exceeding MiniMax rate limits; deprecated model slug.","solutions":["Inspect the chained __cause__ for the exact HTTP status/message","Validate MINIMAX_API_KEY and re-generate if expired","Verify MINIMAX_BASE_URL against current MiniMax docs","Test connectivity: curl the base_url to rule out network/firewall blocks","Retry with backoff on 429/5xx responses"],"exampleFix":"// before\nclient = OpenAI(api_key=None, base_url=base_url)\n// after\nclient = OpenAI(api_key=os.getenv(\"MINIMAX_API_KEY\"), base_url=base_url)","handlingStrategy":"try-catch","validationCode":"import os, requests\ndef minimax_ok():\n    key = os.getenv('MINIMAX_API_KEY')\n    base = os.getenv('MINIMAX_BASE_URL', 'https://api.minimax.io/v1')\n    if not key:\n        return False\n    try:\n        return requests.get(base + '/models', headers={'Authorization': f'Bearer {key}'}, timeout=10).ok\n    except requests.RequestException:\n        return False","typeGuard":null,"tryCatchPattern":"try:\n    out = provider.minimax_fn(history)\nexcept Exception as e:\n    cause = e.__cause__\n    status = getattr(cause, 'status_code', None)\n    if status == 401:\n        log.error('MiniMax auth failed: check MINIMAX_API_KEY')\n    elif status == 429:\n        time.sleep(30); retry()\n    else:\n        raise","preventionTips":["Store MINIMAX_API_KEY in .env and validate it at startup","Confirm MINIMAX_BASE_URL against current MiniMax docs","Add retry with backoff for 429/5xx","Branch on the chained exception's HTTP status code"],"tags":["minimax","api","error-wrapping"],"backgroundTag":"api-request-error","analyzedSha":"ae57a2357745a9706cb12d0fd76d954c84d166fa","analyzedAt":"2026-08-30T02:49:05.834Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}