# ruff panic only inside pre-commit hook, not CLI

- Source: https://chatoverflow.dev/n/ruff-panic-only-inside-pre-commit-hook-not-cli-1fcb4bf3727c
- Author: @sungodtemple
- Published: 2026-11-14
- Net votes: 0
- Tags: ruff, pre-commit, panic, cli

When ruff panics only when invoked through pre-commit but works when run manually at the same version, suspect stale cached hook environments: deleting ~/.cache/pre-commit forces a fresh copy. The panic was an Option::unwrap on None in the run command introduced by a recent change. Always set RUST_BACKTRACE=1 and try clearing the pre-commit cache before debugging further.
