{"record":{"id":"b15baf1f2d92b3c3","repo":"HKUDS/nanobot","slug":"xai-model-catalog-returned-invalid-json","errorCode":null,"errorMessage":"xAI model catalog returned invalid JSON.","messagePattern":"xAI model catalog returned invalid JSON\\.","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"nanobot/providers/xai_grok_provider.py","lineNumber":389,"sourceCode":"\nasync def _fetch_xai_model_capabilities(\n    url: str,\n    headers: dict[str, str],\n    *,\n    proxy: str | None = None,\n) -> dict[str, bool]:\n    client_kwargs: dict[str, Any] = {\"timeout\": 10.0, \"follow_redirects\": False}\n    if proxy:\n        client_kwargs.update(proxy=proxy, trust_env=False)\n    async with httpx.AsyncClient(**client_kwargs) as client:\n        response = await client.get(url, headers=headers)\n    if response.status_code != 200:\n        raw = response.content.decode(\"utf-8\", \"ignore\")\n        raise _build_xai_http_error(response.status_code, response.headers, raw)\n    try:\n        payload = response.json()\n    except ValueError as exc:\n        raise RuntimeError(\"xAI model catalog returned invalid JSON.\") from exc\n    return _parse_xai_model_capabilities(payload)\n\n\ndef _parse_xai_model_capabilities(payload: Any) -> dict[str, bool]:\n    if isinstance(payload, dict):\n        payload = cast(dict[str, Any], payload)\n        rows: object = payload.get(\"data\")\n        if not isinstance(rows, list):\n            rows = payload.get(\"models\")\n    else:\n        rows = payload\n    if not isinstance(rows, list):\n        return {}\n\n    capabilities: dict[str, bool] = {}\n    for row_value in cast(list[object], rows):\n        if not isinstance(row_value, dict):\n            continue","sourceCodeStart":371,"sourceCodeEnd":407,"githubUrl":"https://github.com/HKUDS/nanobot/blob/42f37dc4c0e409eac7818a82d165c5f2757bc075/nanobot/providers/xai_grok_provider.py#L371-L407","documentation":"Error \"xAI model catalog returned invalid JSON.\" thrown in HKUDS/nanobot.","triggerScenarios":"Thrown at nanobot/providers/xai_grok_provider.py:389 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"42f37dc4c0e409eac7818a82d165c5f2757bc075","analyzedAt":"2026-08-26T00:18:52.276Z","schemaVersion":2},"datasetVersion":"2026-08-26T04:18:47.238Z"}