"(DBConnection.EncodeError) Postgrex expected an integer" when running update_users_following_followers_counts
Environment
- Installation type (OTP or From Source): OTP
- Pleroma version (could be found in the "Version" tab of settings in Pleroma-FE): Backend version 2.5.1 / Frontend version eec27700
- Elixir version (
elixir -v
for from source installations, N/A for OTP): N/A - OTP version: 23.3.4.18
- Operating system: Debian 11.6
- PostgreSQL version (
psql -V
): psql (PostgreSQL) 13.9 (Debian 13.9-0+deb11u1)
Bug description
The following stacktrace appeared after round about 24 hours of running su pleroma -s $SHELL -lc "./bin/pleroma_ctl database update_users_following_followers_counts"
10:26:11.235 [debug] Fetching object https://mastodon.adtension.com/users/admin/following via AP
10:26:12.141 [debug] QUERY OK source="instances" db=0.6ms
SELECT TRUE FROM "instances" AS i0 WHERE ((i0."host" = $1) AND (i0."unreachable_since" <= $2)) ["mastodon.adtension.com", ~N[2023-03-29 08:26:12.140334]]
10:26:12.141 [debug] Fetching object https://mastodon.adtension.com/users/admin/followers via AP
10:26:12.217 [debug] QUERY OK source="instances" db=0.6ms
SELECT TRUE FROM "instances" AS i0 WHERE ((i0."host" = $1) AND (i0."unreachable_since" <= $2)) ["mastodon.adtension.com", ~N[2023-03-29 08:26:12.216349]]
10:26:12.220 [debug] QUERY ERROR db=1.5ms
UPDATE "users" SET "follower_count" = $1, "following_count" = $2, "hide_followers" = $3, "hide_follows" = $4, "updated_at" = $5 WHERE "id" = $6 [97000000000, 96997, true, true, ~N[2023-04-05 08:26:12], "AR2twWSuwfZ7vu2emm"]
10:26:12.220 [debug] QUERY OK source="users" db=0.1ms
SELECT u0."id", u0."bio", u0."raw_bio", u0."email", u0."name", u0."nickname", u0."password_hash", u0."keys", u0."public_key", u0."ap_id", u0."avatar", u0."local", u0."follower_address", u0."following_address", u0."featured_address", u0."tags", u0."last_refreshed_at", u0."last_digest_emailed_at", u0."banner", u0."background", u0."note_count", u0."follower_count", u0."following_count", u0."is_locked", u0."is_confirmed", u0."password_reset_pending", u0."is_approved", u0."registration_reason", u0."confirmation_token", u0."default_scope", u0."domain_blocks", u0."is_active", u0."no_rich_text", u0."ap_enabled", u0."is_moderator", u0."is_admin", u0."show_role", u0."uri", u0."hide_followers_count", u0."hide_follows_count", u0."hide_followers", u0."hide_follows", u0."hide_favorites", u0."email_notifications", u0."mascot", u0."emoji", u0."pleroma_settings_store", u0."fields", u0."raw_fields", u0."is_discoverable", u0."invisible", u0."allow_following_move", u0."skip_thread_containment", u0."actor_type", u0."also_known_as", u0."inbox", u0."shared_inbox", u0."accepts_chat_messages", u0."last_active_at", u0."disclose_client", u0."pinned_objects", u0."is_suggested", u0."last_status_at", u0."birthday", u0."show_birthday", u0."language", u0."notification_settings", u0."blocks", u0."mutes", u0."muted_reblogs", u0."muted_notifications", u0."subscribers", u0."multi_factor_authentication_settings", u0."inserted_at", u0."updated_at" FROM "users" AS u0 []
10:26:12.223 [debug] QUERY OK db=2.6ms
rollback []
** (DBConnection.EncodeError) Postgrex expected an integer in -2147483648..2147483647, got 97000000000. Please make sure the value you are passing matches the definition in your table or in your query or convert the value accordingly.
lib/postgrex/type_module.ex:947: Postgrex.DefaultTypes.encode_params/3
lib/postgrex/query.ex:75: DBConnection.Query.Postgrex.Query.encode/3
lib/db_connection.ex:1255: DBConnection.encode/5
lib/db_connection.ex:1355: DBConnection.run_prepare_execute/5
lib/db_connection.ex:595: DBConnection.parsed_prepare_execute/5
lib/db_connection.ex:587: DBConnection.prepare_execute/4
lib/postgrex.ex:340: Postgrex.query/4
lib/ecto/adapters/sql.ex:947: Ecto.Adapters.SQL.struct/10