{"record":{"id":"b002aacab4fcc926","repo":"plandex-ai/plandex","slug":"litellm-proxy-launch-failed-w","errorCode":null,"errorMessage":"LiteLLM proxy launch failed: %w","messagePattern":"LiteLLM proxy launch failed: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"app/server/model/litellm.go","lineNumber":36,"sourceCode":")\n\nfunc EnsureLiteLLM(numWorkers int) error {\n\tvar finalErr error\n\tliteLLMOnce.Do(func() {\n\t\tif isLiteLLMHealthy() {\n\t\t\tlog.Println(\"LiteLLM proxy is already healthy\")\n\t\t\treturn\n\t\t}\n\n\t\tlog.Println(\"LiteLLM proxy is not running. Starting...\")\n\n\t\tctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)\n\t\tdefer cancel()\n\n\t\terr := startLiteLLMServer(numWorkers)\n\t\tif err != nil {\n\t\t\tlog.Println(\"LiteLLM proxy launch failed:\", err)\n\t\t\tfinalErr = fmt.Errorf(\"LiteLLM proxy launch failed: %w\", err)\n\t\t\treturn\n\t\t}\n\n\t\tticker := time.NewTicker(500 * time.Millisecond)\n\t\tdefer ticker.Stop()\n\n\t\tfor {\n\t\t\tselect {\n\t\t\tcase <-ctx.Done():\n\t\t\t\tlog.Println(\"LiteLLM proxy launch timed out\")\n\t\t\t\tfinalErr = fmt.Errorf(\"LiteLLM proxy launch timed out\")\n\t\t\t\treturn\n\t\t\tcase <-ticker.C:\n\t\t\t\tif isLiteLLMHealthy() {\n\t\t\t\t\tlog.Println(\"LiteLLM proxy is healthy\")\n\t\t\t\t\treturn\n\t\t\t\t} else {\n\t\t\t\t\tlog.Println(\"LiteLLM proxy is not healthy yet, retrying after 500ms...\")","sourceCodeStart":18,"sourceCodeEnd":54,"githubUrl":"https://github.com/plandex-ai/plandex/blob/e2d772072efadbe41d2946d97d79be55532dbab5/app/server/model/litellm.go#L18-L54","documentation":"The library failed to launch the local LiteLLM proxy server process. startLiteLLMServer returned an error during startup (within a 10s window), logged and wrapped here as finalErr. Any code depending on the proxy for model routing will be unavailable.","triggerScenarios":"startLiteLLMServer(numWorkers) fails: litellm binary/Python module missing, port already in use, invalid litellm config file, insufficient permissions, or the process exits immediately after spawn.","commonSituations":"LiteLLM not installed or wrong Python environment; config.yaml path/env vars missing; port conflict with another process; host missing python/pip or venv not activated in deployment image.","solutions":["Read the wrapped cause in logs for the exact spawn failure","Verify litellm is installed and on PATH (`litellm --version` or `pip show litellm`)","Check that the proxy port is free (lsof/netstat) and not bound by a stale process","Validate the litellm config file referenced by the launcher","Ensure deployment image includes Python and LiteLLM dependencies"],"exampleFix":"// before: silent dependency on litellm being installed\nerr := startLiteLLMServer(numWorkers)\n// after: preflight the binary\nif _, err := exec.LookPath(\"litellm\"); err != nil {\n    return fmt.Errorf(\"litellm not installed: %w\", err)\n}\nerr := startLiteLLMServer(numWorkers)","handlingStrategy":"validation","validationCode":"if _, err := exec.LookPath(\"litellm\"); err != nil {\n    return fmt.Errorf(\"litellm not installed or not on PATH\")\n}\nif cfg == nil || cfg.ConfigPath == \"\" { return errors.New(\"litellm config path missing\") }","typeGuard":null,"tryCatchPattern":"err := EnsureLiteLLMRunning(numWorkers)\nif err != nil {\n    var launchErr *LaunchError\n    if errors.As(err, &launchErr) { log.Fatalf(\"litellm launch: %v\", launchErr.Cause) }\n    return err\n}","preventionTips":["Pin and pre-install LiteLLM in the deployment image","Verify the proxy port is free before startup","Validate the litellm config file in CI","Fail fast at boot with a preflight binary/config check"],"tags":["litellm","process-launch","proxy","startup"],"backgroundTag":"process-launch-failed","analyzedSha":"e2d772072efadbe41d2946d97d79be55532dbab5","analyzedAt":"2026-09-05T20:56:53.631Z","contentChangedAt":"2026-09-05T20:56:53.631Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}