{"record":{"id":"961924b819731353","repo":"BerriAI/litellm","slug":"json-dumps-completion-response","errorCode":null,"errorMessage":"{json.dumps(completion_response)}","messagePattern":"\\{json\\.dumps\\(completion_response\\)\\}","errorType":"exception","errorClass":"AlephAlphaError","httpStatus":null,"severity":"error","filePath":"litellm/llms/deprecated_providers/aleph_alpha.py","lineNumber":273,"sourceCode":"                status_code=response.status_code,\n            )\n        else:\n            try:\n                choices_list: Final = []\n                for idx, item in enumerate(completion_response[\"completions\"]):\n                    if len(item[\"completion\"]) > 0:\n                        message_obj = Message(content=item[\"completion\"])\n                    else:\n                        message_obj = Message(content=None)\n                    choice_obj = Choices(\n                        finish_reason=item[\"finish_reason\"],\n                        index=idx + 1,\n                        message=message_obj,\n                    )\n                    choices_list.append(choice_obj)\n                model_response.choices = choices_list\n            except Exception:\n                raise AlephAlphaError(\n                    message=json.dumps(completion_response),\n                    status_code=response.status_code,\n                )\n\n        ## CALCULATING USAGE - baseten charges on time, not tokens - have some mapping of cost here.\n        prompt_tokens: Final = len(encoding.encode(prompt))\n        completion_tokens: Final = len(\n            encoding.encode(\n                model_response[\"choices\"][0][\"message\"][\"content\"],\n                disallowed_special=(),\n            )\n        )\n\n        model_response.created = int(time.time())\n        model_response.model = model\n        usage: Final = Usage(\n            prompt_tokens=prompt_tokens,\n            completion_tokens=completion_tokens,","sourceCodeStart":255,"sourceCodeEnd":291,"githubUrl":"https://github.com/BerriAI/litellm/blob/6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d/litellm/llms/deprecated_providers/aleph_alpha.py#L255-L291","documentation":"Error \"{json.dumps(completion_response)}\" thrown in BerriAI/litellm.","triggerScenarios":"Thrown at litellm/llms/deprecated_providers/aleph_alpha.py:273 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the Aleph Alpha completion response for details."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d","analyzedAt":"2026-08-15T07:12:03.035Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}