{"record":{"id":"ce7588eced529c13","repo":"microsoft/VibeVoice","slug":"model-path-not-set-in-environment","errorCode":null,"errorMessage":"MODEL_PATH not set in environment","messagePattern":"MODEL_PATH not set in environment","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"critical","filePath":"demo/web/app.py","lineNumber":345,"sourceCode":"            thread.join()\n            if errors:\n                emit(\"generation_error\", message=str(errors[0]))\n                raise errors[0]\n\n    def chunk_to_pcm16(self, chunk: np.ndarray) -> bytes:\n        chunk = np.clip(chunk, -1.0, 1.0)\n        pcm = (chunk * 32767.0).astype(np.int16)\n        return pcm.tobytes()\n\n\napp = FastAPI()\n\n\n@app.on_event(\"startup\")\nasync def _startup() -> None:\n    model_path = os.environ.get(\"MODEL_PATH\")\n    if not model_path:\n        raise RuntimeError(\"MODEL_PATH not set in environment\")\n\n    device = os.environ.get(\"MODEL_DEVICE\", \"cuda\")\n    \n    service = StreamingTTSService(\n        model_path=model_path,\n        device=device\n    )\n    service.load()\n\n    app.state.tts_service = service\n    app.state.model_path = model_path\n    app.state.device = device\n    app.state.websocket_lock = asyncio.Lock()\n    print(\"[startup] Model ready.\")\n\n\ndef streaming_tts(text: str, **kwargs) -> Iterator[np.ndarray]:\n    service: StreamingTTSService = app.state.tts_service","sourceCodeStart":327,"sourceCodeEnd":363,"githubUrl":"https://github.com/microsoft/VibeVoice/blob/94da20d98b2fa7688e9cbfaf7692ddb4954f7600/demo/web/app.py#L327-L363","documentation":"Raised by the FastAPI startup hook in demo/web/app.py: the app requires the MODEL_PATH environment variable to point at the VibeVoice streaming model checkpoint, and refuses to start without it. It is a hard configuration gate before any model loading begins.","triggerScenarios":"Running uvicorn demo.web.app:app (or the container) without exporting MODEL_PATH; MODEL_PATH set to an empty string (falsy); env var set in a different shell/session than the one launching the server.","commonSituations":"Following the web demo README but skipping the export step; deploying to Docker/systemd where the env var was not passed through; typo'd variable name (e.g. MODEL_DIR).","solutions":["Export MODEL_PATH to the streaming model directory before starting: export MODEL_PATH=/path/to/VibeVoiceStreaming then uvicorn ...","Verify with echo \"$MODEL_PATH\" in the same shell/session that launches the server.","For Docker/systemd, pass the variable explicitly (-e MODEL_PATH=... / Environment=MODEL_PATH=...).","Optionally wrap startup in a check that prints a clear message listing required env vars (MODEL_PATH, optional MODEL_DEVICE, VOICE_PRESET)."],"exampleFix":"# before\nuvicorn web.app:app  # RuntimeError: MODEL_PATH not set\n\n# after\nexport MODEL_PATH=/models/VibeVoiceStreaming\nexport MODEL_DEVICE=cuda\nuvicorn web.app:app","handlingStrategy":"validation","validationCode":"import os\nmodel_path = os.environ.get(\"MODEL_PATH\")\nif not model_path or not os.path.isdir(model_path):\n    raise SystemExit(\"Set MODEL_PATH to the streaming model directory, e.g. export MODEL_PATH=/models/VibeVoiceStreaming\")","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Export MODEL_PATH in the launching shell or service unit","Pass -e MODEL_PATH=... in Docker runs","Add a startup preflight that also validates optional MODEL_DEVICE and VOICE_PRESET"],"tags":["web-demo","environment","configuration","startup"],"backgroundTag":null,"analyzedSha":"94da20d98b2fa7688e9cbfaf7692ddb4954f7600","analyzedAt":"2026-08-15T04:12:07.418Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}