User bweissman reported an issue where the user admin panel failed to load existing user profiles, displaying a generic error, while new users worked fine. After riking requested network logs, bweissman provided a stack trace indicating a 500 Internal Server Error. Although initial attempts to check /logs failed, bweissman eventually identified the root cause: a PG::DatetimeFieldOverflow error caused by a corrupted timestamp in the user_histories table (specifically the date 2735892-07-09 17:17:08.646893 BC). codinghorror suggested a related Meta Discourse thread, which bweissman confirmed resolved the issue.
I got the logs working. This is what happens every time it tries to load a user admin page.
(!)
PG::DatetimeFieldOverflow: ERROR: timestamp out of range: “2735892-07-09 17:17:08.646893 BC”
LINE 1: …“user_histories”.“action” = 15 AND (created_at >= '2735892-0…
^
: SELECT 1 AS one FROM “user_histories” WHERE “user_histories”.“target_user_id” = 1 AND “user_histories”.“action” = 15 AND (created_at >= ‘2735892-07-09 17:17:08.646893 BC’) AND “user_histories”.“previous_value” = ‘2’ AND “user_histories”.“new_value” = ‘3’ LIMIT 1
(!!)
ActiveRecord::StatementInvalid (PG::DatetimeFieldOverflow: ERROR: timestamp out of range: “2735892-07-09 17:17:08.646893 BC”
LINE 1: …“user_histories”.“action” = 15 AND (created_at >= '2735892-0…
^
: SELECT 1 AS one FROM “user_histories” WHERE “user_histories”.“target_user_id” = 1 AND “user_histories”.“action” = 15 AND (created_at >= ‘2735892-07-09 17:17:08.646893 BC’) AND “user_histories”.“previous_value” = ‘2’ AND “user_histories”.“new_value” = ‘3’ LIMIT 1)