Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Panic] in pre-commit with v0.0.273 #5225

Closed
stumpylog opened this issue Jun 20, 2023 · 5 comments · Fixed by #5229
Closed

[Panic] in pre-commit with v0.0.273 #5225

stumpylog opened this issue Jun 20, 2023 · 5 comments · Fixed by #5229
Assignees
Labels
bug Something isn't working

Comments

@stumpylog
Copy link

After updating my pre-commit hook from 0.0.272 to 0.0.273, running ruff via pre-commit fails with a panic. Running ruff manually at the same version works without issue. There's no pyproject, and my .ruff.toml was unchanged. Running just the ruff hook also works find. I've removed ~/.cache/pre-commit to get a fresh copy, which still fails.

After setting RUST_BACKTRACE=1, the log is as below:

ruff.....................................................................Failed
- hook id: ruff
- exit code: 101

error: `ruff` crashed. This indicates a bug in `ruff`. If you could open an issue at:

https://github.com/astral-sh/ruff/issues/new?title=%5BPanic%5D

quoting the executed command, along with the relevant file contents and `pyproject.toml` settings, we'd be very appreciative!

thread '<unnamed>' panicked at 'called `Option::unwrap()` on a `None` value', crates\ruff_cli\src\commands\run.rs:
error: `ruff` crashed. This indicates a bug in `ruff`. If you could open an issue at:

https://github.com/astral-sh/ruff/issues/new?title=%5BPanic%5D

quoting the executed command, along with the relevant file contents and `pyproject.toml` settings, we'd be very appreciative!

thread '<unnamed>' panicked at 'called `Option::unwrap()` on a `None` value', crates\ruff_cli\src\commands\run.rs:112:65
112:65
stack backtrace:

error: `ruff` crashed. This indicates a bug in `ruff`. If you could open an issue at:

https://github.com/astral-sh/ruff/issues/new?title=%5BPanic%5D

quoting the executed command, along with the relevant file contents and `pyproject.toml` settings, we'd be very appreciative!

thread '<unnamed>' panicked at 'called `Option::unwrap()` on a `None` value', crates\ruff_cli\src\commands\run.rs:112:65

error: `ruff` crashed. This indicates a bug in `ruff`. If you could open an issue at:

https://github.com/astral-sh/ruff/issues/new?title=%5BPanic%5D

quoting the executed command, along with the relevant file contents and `pyproject.toml` settings, we'd be very appreciative!

thread '<unnamed>' panicked at 'called `Option::unwrap()` on a `None` value', crates\ruff_cli\src\commands\run.rs:112:65

error: `ruff` crashed. This indicates a bug in `ruff`. If you could open an issue at:

https://github.com/astral-sh/ruff/issues/new?title=%5BPanic%5D

quoting the executed command, along with the relevant file contents and `pyproject.toml` settings, we'd be very appreciative!

thread '<unnamed>' panicked at 'called `Option::unwrap()` on a `None` value', crates\ruff_cli\src\commands\run.rs:112:65

error: `ruff` crashed. This indicates a bug in `ruff`. If you could open an issue at:

https://github.com/astral-sh/ruff/issues/new?title=%5BPanic%5D

quoting the executed command, along with the relevant file contents and `pyproject.toml` settings, we'd be very appreciative!

thread '<unnamed>' panicked at 'called `Option::unwrap()` on a `None` value', crates\ruff_cli\src\commands\run.rs:112:65
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
stack backtrace:
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
stack backtrace:
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
stack backtrace:
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
stack backtrace:
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
stack backtrace:
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
@stumpylog stumpylog changed the title [Panic] [Panic] in pre-commit with v0.0.273 Jun 20, 2023
@hauntsaninja
Copy link
Contributor

I'm running into this too, cc @Thomasdezeeuw since the panicking line blames to #5120

@charliermarsh
Copy link
Member

I don’t know the cause, but I’ll cut a fix for this tonight.

@charliermarsh charliermarsh self-assigned this Jun 20, 2023
@charliermarsh charliermarsh added the bug Something isn't working label Jun 20, 2023
@charliermarsh
Copy link
Member

I'm taking a look now.

@charliermarsh
Copy link
Member

Are any of these projects public, to help me reproduce?

@hauntsaninja
Copy link
Contributor

I don't have a public reproducer. If you aren't able to reproduce anywhere, I can try to make one.

charliermarsh added a commit that referenced this issue Jun 20, 2023
## Summary

I haven't been able to determine why / when this is happening, but in
some cases, users are reporting that this `unwrap()` is causing a panic.
It's fine to just return `None` here and fallback to "No cache",
certainly better than panicking (while we figure out the edge case).

Closes #5225.

Closes #5228.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants