{"record":{"id":"173befab95869507","repo":"BerriAI/litellm","slug":"could-not-find-lite-on-your-path-claude-code-s","errorCode":null,"errorMessage":"Could not find `lite` on your PATH. Claude Code's apiKeyHelper needs an absolute path to it, so `lite up` cannot continue.","messagePattern":"Could not find `lite` on your PATH\\. Claude Code's apiKeyHelper needs an absolute path to it, so `lite up` cannot continue\\.","errorType":"exception","errorClass":"UpError","httpStatus":null,"severity":"error","filePath":"litellm/proxy/client/cli/commands/up.py","lineNumber":152,"sourceCode":"        resolved_settings_path.unlink()\n    resolved_backup_path.unlink()\n    return record\n\n\ndef resolve_api_key_helper(base_url: str) -> str:\n    \"\"\"Build the shell command Claude Code should run for its apiKeyHelper.\n\n    Resolves `lite` to an absolute path so the helper works regardless of the\n    PATH visible to whatever subprocess Claude Code spawns it from. Passing\n    --base-url explicitly (rather than relying on the bare invocation Claude\n    Code would otherwise use) makes `print-token` enforce that the cached\n    token was actually issued for this proxy -- without it, a token minted\n    for a different, previously-logged-into proxy would be handed to\n    whichever server `up` currently points at.\n    \"\"\"\n    lite_path: Final = shutil.which(\"lite\")\n    if lite_path is None:\n        raise UpError(\n            \"Could not find `lite` on your PATH. Claude Code's apiKeyHelper needs \"\n            \"an absolute path to it, so `lite up` cannot continue.\"\n        )\n    return f\"{shlex.quote(lite_path)} auth print-token --base-url {shlex.quote(base_url)}\"\n\n\ndef _ensure_fresh_login(ctx: click.Context) -> None:\n    base_url: Final = ctx.obj[\"base_url\"].rstrip(\"/\")\n    token_data = load_token()\n    if token_data and token_data.get(\"base_url\") == base_url and is_cli_token_fresh(token_data):\n        return\n\n    if not sys.stdin.isatty():\n        raise UpError(\n            \"No fresh LiteLLM login found for this proxy. Run `lite login` first (apiKeyHelper \"\n            \"reads this token on every Claude Code request).\"\n        )\n","sourceCodeStart":134,"sourceCodeEnd":170,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/client/cli/commands/up.py#L134-L170","documentation":"Raised by `lite up` (UpError from resolve_api_key_helper in litellm/proxy/client/cli/commands/up.py) when shutil.which(\"lite\") returns None. Before patching ~/.claude/settings.json, `up` must embed an absolute path to the `lite` executable into Claude Code's apiKeyHelper command, because the subprocess Claude Code later spawns may see a different PATH. If the current process cannot resolve `lite`, the helper command cannot be built and `up` aborts before touching any files.","triggerScenarios":"Running `lite up` from a shell whose PATH lacks the directory holding the litellm CLI entrypoint: an unactivated virtualenv, a pipx install without `pipx ensurepath`, a non-login CI shell with a minimal PATH, or a wrapper/IDE terminal that sanitizes or drops the user's PATH entries.","commonSituations":"Installed litellm via pip/pipx into a user site or venv and opened a new terminal before PATH reload; running `lite up` from cron, systemd, or CI where PATH is /usr/bin:/bin; SSH session that didn't source the shell rc; installing into a different Python environment than the one whose bin dir is on PATH.","solutions":["Activate the environment that owns the entrypoint (e.g. `source .venv/bin/activate`) or install it isolated: `pipx install litellm && pipx ensurepath`","Reload the shell (`exec $SHELL` or open a new terminal) and verify with `which lite` and `lite --version` before retrying `lite up`","In CI/cron with a stripped PATH, export the bin directory explicitly first: `export PATH=\"$PATH:/path/to/venv/bin\"`","If it still fails, find where the entrypoint landed (`python -m pip show -f litellm | grep bin` or `pipx list`) and add that directory to PATH"],"exampleFix":"# before\nlite up   # UpError: Could not find `lite` on your PATH ...\n\n# after\nsource ~/.venvs/litellm/bin/activate   # or: pipx ensurepath && exec $SHELL\nwhich lite   # -> /home/me/.venvs/litellm/bin/lite\nlite up","handlingStrategy":"validation","validationCode":"import shutil, subprocess, sys\n\nlite = shutil.which(\"lite\")\nif lite is None:\n    sys.exit(\"`lite` not on PATH — activate its venv or run `pipx ensurepath`, then retry\")\nraise SystemExit(subprocess.call([lite, \"up\"]))","typeGuard":null,"tryCatchPattern":"import click\ntry:\n    run_lite_up()  # anything that shells out to `lite up`\nexcept click.ClickException as e:  # `up` wraps UpError in ClickException for CLI output\n    exit_on_unrecoverable(e.format_message())","preventionTips":["Install the CLI with pipx and run `pipx ensurepath` so the entrypoint dir is always on PATH","In CI, explicitly export the venv bin directory in the job's env before any `lite` command","Smoke-test `which lite && lite --version` at the top of scripts that later call `lite up`"],"tags":["litellm","cli","path","environment"],"backgroundTag":"command-not-found-on-path","analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}