{"record":{"id":"128f497c03fec7fe","repo":"huggingface/transformers","slug":"unknown-error","errorCode":null,"errorMessage":"Unknown error","messagePattern":"Unknown error","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"src/transformers/cli/chat.py","lineNumber":281,"sourceCode":"            TimeElapsedColumn(),\n            console=self._console,\n        )\n        task_id = progress.add_task(_label(\"processor\"), total=None)\n        cached = False\n\n        with Live(progress, console=self._console, transient=True):\n            for line in response.iter_lines():\n                if not line or not line.startswith(b\"data: \"):\n                    continue\n                event = json.loads(line[6:])\n                status = event.get(\"status\")\n\n                if status == \"ready\":\n                    cached = event.get(\"cached\", False)\n                    break\n\n                if status == \"error\":\n                    raise RuntimeError(event.get(\"message\", \"Unknown error\"))\n\n                if status == \"loading\":\n                    stage = event.get(\"stage\")\n                    prog = event.get(\"progress\")\n                    label = _label(stage)\n\n                    if prog:\n                        unit = \"bytes\" if stage == \"download\" else \"items\"\n                        progress.update(\n                            task_id, description=label, completed=prog[\"current\"], total=prog.get(\"total\"), unit=unit\n                        )\n                    else:\n                        progress.update(task_id, description=label, completed=0, total=None)\n\n        if cached:\n            self._console.print(Markdown(f\"_*{model} was already loaded.*_\"))\n        else:\n            self._console.print(Markdown(f\"_*{model} is warm.*_\"))","sourceCodeStart":263,"sourceCodeEnd":299,"githubUrl":"https://github.com/huggingface/transformers/blob/a597f974857b3d92939971296bc0deb93d33d780/src/transformers/cli/chat.py#L263-L299","documentation":"The chat CLI consumes a server-sent-events stream from `transformers serve` and expects status events: ready, loading, or error. When an event with status=='error' arrives, it raises RuntimeError with the server's message, falling back to 'Unknown error' when the event carries no 'message' field. This means model loading or server-side inference failed before the session became ready.","triggerScenarios":"Starting `transformers chat` against a server whose model fails to download or load (OOM, corrupted weights, unsupported architecture, bad dtype/device combo); the server sends {\"status\": \"error\"} with or without a message; model files missing on disk or hub auth failures during load.","commonSituations":"GPU out-of-memory while loading a large model; mistyped or nonexistent model id passed to serve; CUDA/dtype mismatches (e.g. bnb-4bit without bitsandbytes); network/proxy issues fetching weights; hub token missing for a gated repo.","solutions":["Check the server logs in the shell running `transformers serve` for the real traceback","Verify the model id loads standalone: AutoModelForCausalLM.from_pretrained(<id>)","Reduce memory pressure: smaller model, --dtype float16, quantization, or CPU","Ensure required extras are installed (bitsandbytes for bnb, kernels) and hub auth for gated repos","Restart `transformers serve` and re-run `transformers chat` once fixed"],"exampleFix":"# before\ntransformers serve --model_id bigmodel --dtype bfloat16   # OOM on load\ntransformers chat\n\n# after\ntransformers serve --model_id bigmodel --dtype float16 --quantization bnb-4bit\ntransformers chat","handlingStrategy":"retry","validationCode":"# Pre-flight: confirm the model loads before chatting\nimport subprocess, sys\nmodel = \"<model_id>\"\nr = subprocess.run([sys.executable, \"-c\", f\"from transformers import AutoConfig; AutoConfig.from_pretrained('{model}')\"])\nif r.returncode != 0:\n    sys.exit(\"Model unreachable; fix id/auth/network before chat\")","typeGuard":null,"tryCatchPattern":"try:\n    run_chat_session()\nexcept RuntimeError as e:\n    if \"Unknown error\" in str(e) or \"error\" in str(e).lower():\n        log_server_side_failure(); sys.exit(1)\n    raise","preventionTips":["Keep the serving shell visible to read the true traceback","Pre-download weights with huggingface-cli download before serving","Size model vs GPU memory before launch; use quantization or smaller dtype","Authenticate for gated repos: huggingface-cli login"],"tags":["cli","chat","serving","model-loading","runtimeerror"],"backgroundTag":null,"analyzedSha":"a597f974857b3d92939971296bc0deb93d33d780","analyzedAt":"2026-08-14T18:24:08.354Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}