You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
A session's leaf fails with "No module named leaf" once Claude Code cleans up the copy it loaded #6562
In a long-lived Claude Code session, every bare leaf command starts failing once Claude Code cleans up the copy of Leaf the session loaded:
…/bin/python3.12: No module named leaf
A session keeps the copy it loaded on its PATH. After a newer Leaf is installed, Claude Code marks the older copy orphaned (.orphaned_at) and can delete its files while the session still runs. In the session I saw, the cleanup had removed pyproject.toml and most of the tree, and left bin/leaf.
The launcher runs uv run -q --no-dev --project "$root" python -P -m leaf "$@", and the hand-off to the installed copy (session_runtime.hand_off_command) runs inside that Python. So a copy without its project can't hand the command on: uv finds no project at $root and runs whatever python the caller's environment has, which has no leaf module. The session's hooks run the same launcher and fail the same way.
Expected
The session's leaf keeps working, by running the copy installed_plugins.json records, as it does while the session's own copy is whole. The launcher could check for $root/pyproject.toml before uv run and, without it, exec the installed copy's launcher. Failing that, a refusal that names the cause would let the agent find another launcher.
Repro
I hit this in a session whose copy Claude Code had cleaned up. I know no way to trigger that cleanup on demand, so step 3 stands in for it by deleting one of the files it removed.
Start a Claude Code session with Leaf installed.
Install a newer Leaf.
Delete pyproject.toml from the copy the session loaded, as the cleanup did.
Run leaf --version in the session.
Seen on leaf 7b94945, installed 2026-11-19T18:16:20-08:00.
This was written by Claude Code on behalf of max-sixty
I reproduced this, and #6567 fixes it. Once pyproject.toml is gone, uv run --project runs the caller's python. From outside a checkout that gives No module named leaf. From inside a Leaf checkout it is worse: it quietly runs that checkout's Leaf. Either way the Python hand-off never gets a chance to run.
With #6567, bin/leaf checks for the project first. If it is missing, it execs the launcher installed_plugins.json records, which is the rule installed_launcher uses, read with jq. If nothing is recorded, it refuses with a message that points to /reload-plugins. A regression test that fails on the old launcher now passes. CI and landing for the PR are still pending.
Activity
leaf-agent commentedon Nov 20, 2026
I reproduced this, and #6567 fixes it. Once
pyproject.tomlis gone,uv run --projectruns the caller'spython. From outside a checkout that givesNo module named leaf. From inside a Leaf checkout it is worse: it quietly runs that checkout's Leaf. Either way the Python hand-off never gets a chance to run.With #6567,
bin/leafchecks for the project first. If it is missing, it execs the launcherinstalled_plugins.jsonrecords, which is the ruleinstalled_launcheruses, read withjq. If nothing is recorded, it refuses with a message that points to/reload-plugins. A regression test that fails on the old launcher now passes. CI and landing for the PR are still pending.Hand a copy that lost its project to the installed copy too, and refu…