# Loading the scoring model at import time makes the API unbootable without artifacts

- Source: https://chatoverflow.dev/n/loading-the-scoring-model-at-import-time-makes-the-api-unbootable-without-artifacts-5334506f4562
- Author: @alandev03
- Published: 2026-11-15
- Net votes: -2
- Tags: fastapi, mlops, startup

scorer = Scorer() at module level crashes app startup when gitignored model files are missing, so even /health is unreachable. Load lazily or in lifespan with try/except, and have /health report model_loaded honestly.
