{"record":{"id":"b95bb4100015a7da","repo":"tirth8205/code-review-graph","slug":"minimax-api-error-base-resp-get-status-msg-u","errorCode":null,"errorMessage":"MiniMax API error: {base_resp.get('status_msg', 'unknown')}","messagePattern":"MiniMax API error: (.+?)","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"code_review_graph/embeddings.py","lineNumber":319,"sourceCode":"            headers={\n                \"Content-Type\": \"application/json\",\n                \"Authorization\": f\"Bearer {self._api_key}\",\n                \"User-Agent\": _USER_AGENT,\n                \"Accept\": \"application/json\",\n            },\n        )\n\n        max_retries = 3\n        for attempt in range(max_retries):\n            try:\n                import ssl\n                _ssl_ctx = ssl.create_default_context()\n                with urllib.request.urlopen(req, timeout=60, context=_ssl_ctx) as resp:  # nosec B310\n                    body = _json.loads(resp.read().decode(\"utf-8\"))\n\n                base_resp = body.get(\"base_resp\", {})\n                if base_resp.get(\"status_code\", 0) != 0:\n                    raise RuntimeError(\n                        f\"MiniMax API error: {base_resp.get('status_msg', 'unknown')}\"\n                    )\n\n                return body[\"vectors\"]\n            except Exception as e:\n                err_str = str(e)\n                is_retryable = \"429\" in err_str or \"500\" in err_str or \"503\" in err_str\n                if not is_retryable or attempt == max_retries - 1:\n                    raise\n                wait = 2 ** attempt\n                logger.warning(\n                    \"MiniMax API error (attempt %d/%d), retrying in %ds: %s\",\n                    attempt + 1, max_retries, wait, e,\n                )\n                time.sleep(wait)\n\n        return []  # unreachable, but keeps mypy happy\n","sourceCodeStart":301,"sourceCodeEnd":337,"githubUrl":"https://github.com/tirth8205/code-review-graph/blob/b58668751ab0c7670c078cf7cbd4d1f5b8e54f81/code_review_graph/embeddings.py#L301-L337","documentation":"This RuntimeError is raised when the MiniMax embedding API returns a non-zero `base_resp.status_code` in an otherwise successful HTTP response — i.e. the application-level payload reports an error (auth failure, bad input, quota, invalid model). The message surfaces the server's `status_msg` or 'unknown' if absent.","triggerScenarios":"POSTing an embeddings batch to the MiniMax API (embed() or embed_query()) where the response body's base_resp.status_code != 0: expired/invalid API key, model name typo, text exceeding limits, or rate/quota exhaustion.","commonSituations":"Rotated or expired MiniMax API keys in CI, using a model identifier not enabled for the account, or oversized batches (batch_size is capped at 100 in embed).","solutions":["Inspect status_msg in the raised message to identify the exact server-side cause (auth vs quota vs input)","Verify the MiniMax API key environment/credentials are current and valid","Check the model name and reduce batch size / text length to meet MiniMax limits","Add retry with backoff if the status indicates transient throttling"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"# Pre-flight: confirm credentials are configured before batching\nimport os\nassert os.environ.get(\"MINIMAX_API_KEY\"), \"MINIMAX_API_KEY missing\"\nassert 0 < len(texts) <= 100, \"MiniMax batch must be 1..100 items\"","typeGuard":null,"tryCatchPattern":"import time\nfor attempt in range(3):\n    try:\n        vecs = provider.embed(texts)\n        break\n    except RuntimeError as e:\n        msg = str(e)\n        if \"MiniMax API error\" in msg and any(k in msg for k in (\"rate\", \"limit\", \"throttl\")):\n            time.sleep(2 ** attempt)\n            continue\n        raise","preventionTips":["Keep batches at or below 100 items","Alert on auth-flavored status_msg early — retrying won't fix bad credentials","Log base_resp.status_msg so failures are diagnosable","Treat quota errors as backoff signals, not fatal errors"],"tags":["python","minimax","api-error","embeddings","http"],"backgroundTag":"api-error-response","analyzedSha":"b58668751ab0c7670c078cf7cbd4d1f5b8e54f81","analyzedAt":"2026-08-28T13:19:08.966Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}