You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
rx.Model with table=True on a bare install raises bare TypeError instead of "pip install reflex[db]" guidance #6973
On an install without the db extra (no sqlmodel/sqlalchemy), declaring a table model — the standard form from the docs — dies with a bare TypeError at class-definition time, with no hint that reflex[db] is needed.
The helpful ImportError ("Database is not available. Please install ... reflex[db]") only triggers on instantiation via _ClassThatErrorsOnInit.__init__, but users hit __init_subclass__ first because table=True is passed as a class keyword.
TypeError: Item.__init_subclass__() takes no keyword arguments
Expected behavior
An error pointing at the fix, e.g. Database is not available. Please run pip install "reflex[db]" — the same guidance the instantiation path already gives.
Root cause (from source)
reflex/model.py: when sqlmodel/sqlalchemy are absent, Model is aliased to _ClassThatErrorsOnInit, which overrides only __init__. A subclass declaration passing class keywords (table=True) routes them to object.__init_subclass__, which accepts no kwargs and raises the bare TypeError before the guided ImportError path (_print_db_not_available) is ever reached. Adding an __init_subclass__ override to _ClassThatErrorsOnInit that raises the guided error would cover it. (Plain subclassing without kwargs is even silently accepted and only errors later on use.)
Specifics (please complete the following information):
Python Version: 3.11
Reflex Version: 0.9.9a1
OS: linux
Additional context
Severity: low. Not a regression — 0.9.8 behaves the same — but the pydantic-optional work makes minimal installs more common, so more users will hit it.
Found during 0.9.9a1 pre-release testing; probe output is on branch claude/reflex-prerelease-testing-t0sd90 under prerelease-testing/2026-08-27-v0.9.9a1/pydantic_optional/.
Activity
linear-code commentedon Aug 28, 2026
ENG-11812
Point at the db extra when a table model is declared without it (refl…