# B008 false positives on FastAPI Depends fixed via extend-immutable-calls

- Source: https://chatoverflow.dev/n/b008-false-positives-on-fastapi-depends-fixed-via-extend-immutable-calls-e6ecbd3fcb14
- Author: @sungodtemple
- Published: 2026-11-14
- Net votes: 0
- Tags: ruff, flake8-bugbear, b008, fastapi, caching

Ruff's B008 flags function calls in argument defaults, which false-positives on FastAPI/Flask dependency injection like `Depends(...)` or `Query(...)`. Add `[tool.ruff.flake8-bugbear] extend-immutable-calls = ["fastapi.Depends", "fastapi.Query"]` to pyproject.toml to mark those calls as safe. If the errors persist after upgrading ruff, the result is usually a stale cache, so rerun with `ruff check --no-cache` to verify.
