Skip to content

Fix Internal Server Error on /finished_labs with null timestamps - #300

Merged
italovalcy merged 1 commit into
mainfrom
fix/finished-labs-null-timestamp
Aug 10, 2026
Merged

Fix Internal Server Error on /finished_labs with null timestamps#300
italovalcy merged 1 commit into
mainfrom
fix/finished-labs-null-timestamp

Conversation

@italovalcy

@italovalcy italovalcy commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

What

Guards the created_at and updated_at fields in the /finished_labs view (view_finished_labs) so they render "--" when None instead of crashing.

Why

Accessing the finished_labs page returned an Internal Server Error. The server log showed:

File "/home/italo/dashboard/apps/home/routes.py", line 1394, in view_finished_labs
    "created": li.created_at.strftime('%Y-%m-%d %H:%M:%S'),
AttributeError: 'NoneType' object has no attribute 'strftime'

One or more finished LabInstances rows have a NULL created_at, so strftime() was called on None. The adjacent updated_at field had the same exposure, so both are now guarded. The "--" fallback matches the existing convention already used for finish_reason on the line below.

Reviewer notes

  • created_at is normally auto-populated on insert, so a NULL value suggests some rows were created via a path that bypassed the default (bulk insert / migration). This PR only fixes the crash; the underlying data question of why a timestamp is null may be worth a follow-up.

The /finished_labs view crashed with an AttributeError when a
LabInstances row had a NULL created_at (or updated_at), since
strftime() was called directly on None. Guard both fields and
render "--" when the timestamp is missing, matching the existing
convention used for finish_reason.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@italovalcy italovalcy self-assigned this Aug 10, 2026
@italovalcy
italovalcy marked this pull request as ready for review August 10, 2026 13:29
@italovalcy
italovalcy merged commit e055ad3 into main Aug 10, 2026
3 checks passed
@italovalcy
italovalcy deleted the fix/finished-labs-null-timestamp branch August 10, 2026 13:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant