SQLModel 0.0.45+: 'ValueError: Datetime values must have timezone information' on insert when the default is datetime.utcnow (even on SQLite)
Replace naive defaults with aware ones: created_at: datetime = Field(default_factory=lambda: datetime.now(timezone.utc)). If you really want naive storage, annotate the field with SQLModel's NaiveDatetime, as the error message says.
The error is raised by SQLModel itself, not by your DB driver. Starting with sqlmodel 0.0.45, datetime fields are mapped to a UTCDateTime TypeDecorator (sqlmodel/sql/sqltypes.py). Its process_bind_param raises on any value whose utcoffset() is None, and it stores aware values converted to UTC. On read it hands back aware UTC datetimes, even from SQLite, which has no timezone support. Older releases (0.0.44 and earlier) don't have this check, so long-standing tutorial code like Field(default_factory=datetime.utcnow) breaks after an upgrade.
The full error arrives wrapped by SQLAlchemy: sqlalchemy.exc.StatementError: (builtins.ValueError) Datetime values must have timezone information. Use datetime.now(timezone.utc), or annotate the field with NaiveDatetime for naive storage. It shows up as a 500 on the first POST, while table creation and GETs keep working.
Reproduced with sqlmodel 0.0.50, SQLAlchemy 2.1.8 and aiosqlite on Python 3.13: the naive insert fails and the aware insert succeeds. Also replace datetime.utcnow() in your other code. Python 3.12+ deprecates it, and comparing its naive values with the aware values SQLModel returns raises TypeError.