# ruff UP038: tool crashes

Internal evidence sheet generated by fixhunt. Not an issue text. A human re-verifies, checks the duplicates
below, and writes the upstream report in their own words following the project's AI policy.

- Tool: ruff ruff 0.17.1
- Rule: UP038 (tool labels the fix: unknown)
- Oracle: tool-crash
- Judge (Nemotron 3 Ultra, advisory): program-bug, severity low. The rule UP038 has been removed from ruff entirely, so the linter crashes when trying to apply it. The program itself is trivial (x = 5) and contains no isinstance or issubclass calls, so the fix cannot meaningfully apply. The crash is a tooling/environment issue, not a semantic change from a rewrite.
- Program: minimized from 2 to 1 lines

## Reproducer

```python
x = 5
```

## Commands

```sh
python3 prog.py
ruff check --preview --isolated --select UP038 --fix prog.py
python3 prog.py
```

## Observed

```
lint crashed: ruff failed
  Cause: Rule `UP038` was removed and cannot be selected.
```

## Diff applied by the fix

```diff

```

## Why the rewrite is not equivalent (model draft, verify before use)

The rewrite does nothing—it leaves x=5 unchanged—but claims to apply a fix that no longer exists (rule UP038 was removed). Since the tool attempts to enforce a non-existent rule, it crashes instead of producing any output. Thus, the behavior differs: the original program runs fine, while the "fixed" version triggers a tool crash due to missing rule selection, altering execution outcome despite identical source code. No actual code change occurred; the difference arises from the tool’s failure to handle the invalid rule reference. This makes the fix unsafe because it introduces instability without modifying semantics.

## Upstream search

Queries: "UP038 fix", "ruff UP038 assignment expression", "rule UP038 variable initialization pattern", "linter crash due to missing UP038"

- related: https://github.com/astral-sh/ruff/issues/13051
  Existing report is about outdated documentation for UP038 fix safety, not a crash when selecting a removed rule.
- related: https://github.com/astral-sh/ruff/issues/7871
  Existing report is about UP038 rewriting code to be slower, not a crash due to rule removal.
- duplicate: https://github.com/astral-sh/ruff/issues/18349
  Existing report describes the same defect: selecting deprecated/removed rule UP038 causes an error/crash.

<details><summary>All hits</summary>

- [github, closed] `UP038` documentation outdated wrt. fix safety — https://github.com/astral-sh/ruff/issues/13051
- [github, closed] UP038 rewrites code to make it slower and more verbose — https://github.com/astral-sh/ruff/issues/7871
- [github, closed] Warn about error being related to a deprecated rule — https://github.com/astral-sh/ruff/issues/18349
- [github, closed] [Bug] [DOC501 & DOC502] Numpy still docstrings with `:exc:` directive for exceptions are falsely flagged — https://github.com/astral-sh/ruff/issues/14609
- [github, closed] `# flake8: noqa` top-of-the-file comment doesn't respect `external` config — https://github.com/astral-sh/ruff/issues/10202
- [github, closed] Fixed code unformatted — https://github.com/astral-sh/ruff/issues/8619
- [github, closed] Add option to disable preview warnings — https://github.com/astral-sh/ruff/issues/8620
- [github, closed] Implement pyupgrade — https://github.com/astral-sh/ruff/issues/827

</details>
