{"record":{"id":"3c86a33257f086b9","repo":"BerriAI/litellm","slug":"error-replicate-error","errorCode":null,"errorMessage":"Error: {replicate_error}","messagePattern":"Error: (.+?)","errorType":"exception","errorClass":"ReplicateError","httpStatus":400,"severity":"error","filePath":"litellm/llms/replicate/chat/handler.py","lineNumber":56,"sourceCode":"            response_data = response.json()\n            status = response_data[\"status\"]\n            if \"output\" in response_data:\n                try:\n                    output_string = \"\".join(response_data[\"output\"])\n                except Exception:\n                    raise ReplicateError(\n                        status_code=422,\n                        message=\"Unable to parse response. Got={}\".format(response_data[\"output\"]),\n                        headers=response.headers,\n                    )\n                new_output = output_string[len(previous_output) :]\n                print_verbose(f\"New chunk: {new_output}\")\n                yield {\"output\": new_output, \"status\": status}\n                previous_output = output_string\n            status = response_data[\"status\"]\n            if status == \"failed\":\n                replicate_error = response_data.get(\"error\", \"\")\n                raise ReplicateError(\n                    status_code=400,\n                    message=f\"Error: {replicate_error}\",\n                    headers=response.headers,\n                )\n        else:\n            # this can fail temporarily but it does not mean the replicate request failed, replicate request fails when status==\"failed\"\n            print_verbose(\n                f\"Replicate: Failed to fetch prediction status and output.{response.status_code}{response.text}\"\n            )\n\n\n# Function to handle prediction response (streaming)\nasync def async_handle_prediction_response_streaming(\n    prediction_url,\n    api_token,\n    print_verbose,\n    headers: dict,\n    http_client: AsyncHTTPHandler,","sourceCodeStart":38,"sourceCodeEnd":74,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/llms/replicate/chat/handler.py#L38-L74","documentation":"Error propagation in the Replicate streaming poller: the prediction failed and the response carries an 'error' field, whose value (replicate_error) is surfaced verbatim in a ReplicateError so the caller sees Replicate's failure reason.","triggerScenarios":"Triggered when the Replicate API returns an error payload for a chat prediction.","commonSituations":"See trigger scenarios.","solutions":["Inspect the replicate_error value; the prediction failed on Replicate's side.","Check the model version, input schema, and your Replicate account status/quota."],"exampleFix":"# run the same input directly against the Replicate API to reproduce.","handlingStrategy":"type-guard","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}