🐛 Bug Report: An error may occur when reading the timestamptz type. #434

Closed
opened 2025-10-07 00:14:49 +03:00 by OVERLORD · 3 comments
Owner

Originally created by @simono41 on GitHub.

Reproduction steps

When I create a new one-time link and log in with it, the following error message comes from the log: unable to encode 1734048708 into binary format for timestamptz (OID 1184): cannot find encode plan

Expected behavior

I was able to log in successfully and deposit a passkey because the direct migration from SQLite didn't work,

Actual Behavior

grafik

pocket-id | [GIN] 2024/12/13 - 00:11:29 | 200 | 398.56µs | 2003:df:bf0a:a800::18cb | GET "/api/application-configuration/favicon"
pocket-id |
pocket-id | 2024/12/13 00:11:30 /app/backend/internal/service/user_service.go:115 failed to encode args[1]: unable to encode 1734048690 into binary format for timestamptz (OID 1184): cannot find encode plan
pocket-id | [1.232ms] [rows:0] SELECT * FROM "one_time_access_tokens" WHERE token = 1 AND expires_at > 2 ORDER BY "one_time_access_tokens"."id" LIMIT 3
pocket-id | [GIN] 2024/12/13 - 00:11:30 | 500 | 1.389682ms | 2003:df:bf0a:a800::18cb | POST "/api/one-time-access-token/Zk98d00afyhxUjFk"
pocket-id | Error #01: failed to encode args[1]: unable to encode 1734048690 into binary format for timestamptz (OID 1184): cannot find encode plan
pocket-id | [GIN] 2024/12/13 - 00:11:30 | 500 | 1.418602ms | 2003:df:bf0a:a800::18cb | POST "/api/one-time-access-token/Zk98d00afyhxUjFk"
pocket-id | Error #01: failed to encode args[1]: unable to encode 1734048690 into binary format for timestamptz (OID 1184): cannot find encode plan
pocket-id | 2024-12-13 00:11:30.623383886 +0000 UTC m=+701.643109662 write error: can't make directories for new logfile: mkdir /var/log/caddy: permission denied
pocket-id | [GIN] 2024/12/13 - 00:11:32 | 401 | 51.68µs | 127.0.0.1 | GET "/api/users/me"
pocket-id | Error #01: You are not signed in
pocket-id | [GIN] 2024/12/13 - 00:11:32 | 401 | 92.48µs | 127.0.0.1 | GET "/api/users/me"
pocket-id | Error #01: You are not signed in
pocket-id | [GIN] 2024/12/13 - 00:11:32 | 200 | 879.441µs | 127.0.0.1 | GET "/api/application-configuration"
pocket-id | [GIN] 2024/12/13 - 00:11:32 | 200 | 961.041µs | 127.0.0.1 | GET "/api/application-configuration"
pocket-id | [GIN] 2024/12/13 - 00:11:32 | 200 | 1.553002ms | 127.0.0.1 | GET "/api/oidc/clients/f7beb72b-7e4b-4138-a181-232e8cb5e215"
pocket-id | [GIN] 2024/12/13 - 00:11:32 | 200 | 1.603362ms | 127.0.0.1 | GET "/api/oidc/clients/f7beb72b-7e4b-4138-a181-232e8cb5e215"
pocket-id | [GIN] 2024/12/13 - 00:11:43 | 401 | 72.201µs | 127.0.0.1 | GET "/api/users/me"
pocket-id | Error #01: You are not signed in
pocket-id | [GIN] 2024/12/13 - 00:11:43 | 401 | 177.881µs | 127.0.0.1 | GET "/api/users/me"
pocket-id | Error #01: You are not signed in
pocket-id | [GIN] 2024/12/13 - 00:11:43 | 200 | 1.151122ms | 127.0.0.1 | GET "/api/application-configuration"
pocket-id | [GIN] 2024/12/13 - 00:11:43 | 200 | 1.767963ms | 127.0.0.1 | GET "/api/application-configuration"
pocket-id | [GIN] 2024/12/13 - 00:11:43 | 401 | 52.04µs | 127.0.0.1 | GET "/api/users/me"
pocket-id | Error #01: You are not signed in
pocket-id | [GIN] 2024/12/13 - 00:11:43 | 401 | 92.88µs | 127.0.0.1 | GET "/api/users/me"
pocket-id | Error #01: You are not signed in
pocket-id | [GIN] 2024/12/13 - 00:11:43 | 200 | 629.001µs | 127.0.0.1 | GET "/api/application-configuration"
pocket-id | [GIN] 2024/12/13 - 00:11:43 | 200 | 678.361µs | 127.0.0.1 | GET "/api/application-configuration"
pocket-id |
pocket-id | 2024/12/13 00:11:48 /app/backend/internal/service/user_service.go:115 failed to encode args[1]: unable to encode 1734048708 into binary format for timestamptz (OID 1184): cannot find encode plan
pocket-id | [0.919ms] [rows:0] SELECT * FROM "one_time_access_tokens" WHERE token = 1 AND expires_at > 2 ORDER BY "one_time_access_tokens"."id" LIMIT 3
pocket-id | [GIN] 2024/12/13 - 00:11:48 | 500 | 1.111162ms | 2003:df:bf0a:a800::18cb | POST "/api/one-time-access-token/Zk98d00afyhxUjFk"
pocket-id | Error #01: failed to encode args[1]: unable to encode 1734048708 into binary format for timestamptz (OID 1184): cannot find encode plan
pocket-id | [GIN] 2024/12/13 - 00:11:48 | 500 | 1.139082ms | 2003:df:bf0a:a800::18cb | POST "/api/one-time-access-token/Zk98d00afyhxUjFk"
pocket-id | Error #01: failed to encode args[1]: unable to encode 1734048708 into binary format for timestamptz (OID 1184): cannot find encode plan
pocket-id | 2024-12-13 00:11:48.601837631 +0000 UTC m=+719.621563407 write error: can't make directories for new logfile: mkdir /var/log/caddy: permission denied
pocket-id | [GIN] 2024/12/13 - 00:12:13 | 401 | 375.04µs | 127.0.0.1 | GET "/api/users/me"
pocket-id | Error #01: You are not signed in
pocket-id | [GIN] 2024/12/13 - 00:12:13 | 401 | 449.481µs | 127.0.0.1 | GET "/api/users/me"
pocket-id | Error #01: You are not signed in
pocket-id | [GIN] 2024/12/13 - 00:12:13 | 200 | 1.162721ms | 127.0.0.1 | GET "/api/application-configuration"
pocket-id | [GIN] 2024/12/13 - 00:12:13 | 200 | 1.211441ms | 127.0.0.1 | GET "/api/application-configuration"
pocket-id | [GIN] 2024/12/13 - 00:12:13 | 401 | 51.52µs | 127.0.0.1 | GET "/api/users/me"
pocket-id | Error #01: You are not signed in
pocket-id | [GIN] 2024/12/13 - 00:12:13 | 401 | 155.601µs | 127.0.0.1 | GET "/api/users/me"
pocket-id | Error #01: You are not signed in
pocket-id | [GIN] 2024/12/13 - 00:12:13 | 200 | 565.841µs | 127.0.0.1 | GET "/api/application-configuration"
pocket-id | [GIN] 2024/12/13 - 00:12:13 | 200 | 614.561µs | 127.0.0.1 | GET "/api/application-configuration"

Originally created by @simono41 on GitHub. ### Reproduction steps When I create a new one-time link and log in with it, the following error message comes from the log: unable to encode 1734048708 into binary format for timestamptz (OID 1184): cannot find encode plan ### Expected behavior I was able to log in successfully and deposit a passkey because the direct migration from SQLite didn't work, ### Actual Behavior ![grafik](https://github.com/user-attachments/assets/a56b84ee-64ca-4a21-ace1-3b46d0df97b9) pocket-id | [GIN] 2024/12/13 - 00:11:29 | 200 | 398.56µs | 2003:df:bf0a:a800::18cb | GET "/api/application-configuration/favicon" pocket-id | pocket-id | 2024/12/13 00:11:30 /app/backend/internal/service/user_service.go:115 failed to encode args[1]: unable to encode 1734048690 into binary format for timestamptz (OID 1184): cannot find encode plan pocket-id | [1.232ms] [rows:0] SELECT * FROM "one_time_access_tokens" WHERE token = $1$ AND expires_at > $2$ ORDER BY "one_time_access_tokens"."id" LIMIT $3$ pocket-id | [GIN] 2024/12/13 - 00:11:30 | 500 | 1.389682ms | 2003:df:bf0a:a800::18cb | POST "/api/one-time-access-token/Zk98d00afyhxUjFk" pocket-id | Error #01: failed to encode args[1]: unable to encode 1734048690 into binary format for timestamptz (OID 1184): cannot find encode plan pocket-id | [GIN] 2024/12/13 - 00:11:30 | 500 | 1.418602ms | 2003:df:bf0a:a800::18cb | POST "/api/one-time-access-token/Zk98d00afyhxUjFk" pocket-id | Error #01: failed to encode args[1]: unable to encode 1734048690 into binary format for timestamptz (OID 1184): cannot find encode plan pocket-id | 2024-12-13 00:11:30.623383886 +0000 UTC m=+701.643109662 write error: can't make directories for new logfile: mkdir /var/log/caddy: permission denied pocket-id | [GIN] 2024/12/13 - 00:11:32 | 401 | 51.68µs | 127.0.0.1 | GET "/api/users/me" pocket-id | Error #01: You are not signed in pocket-id | [GIN] 2024/12/13 - 00:11:32 | 401 | 92.48µs | 127.0.0.1 | GET "/api/users/me" pocket-id | Error #01: You are not signed in pocket-id | [GIN] 2024/12/13 - 00:11:32 | 200 | 879.441µs | 127.0.0.1 | GET "/api/application-configuration" pocket-id | [GIN] 2024/12/13 - 00:11:32 | 200 | 961.041µs | 127.0.0.1 | GET "/api/application-configuration" pocket-id | [GIN] 2024/12/13 - 00:11:32 | 200 | 1.553002ms | 127.0.0.1 | GET "/api/oidc/clients/f7beb72b-7e4b-4138-a181-232e8cb5e215" pocket-id | [GIN] 2024/12/13 - 00:11:32 | 200 | 1.603362ms | 127.0.0.1 | GET "/api/oidc/clients/f7beb72b-7e4b-4138-a181-232e8cb5e215" pocket-id | [GIN] 2024/12/13 - 00:11:43 | 401 | 72.201µs | 127.0.0.1 | GET "/api/users/me" pocket-id | Error #01: You are not signed in pocket-id | [GIN] 2024/12/13 - 00:11:43 | 401 | 177.881µs | 127.0.0.1 | GET "/api/users/me" pocket-id | Error #01: You are not signed in pocket-id | [GIN] 2024/12/13 - 00:11:43 | 200 | 1.151122ms | 127.0.0.1 | GET "/api/application-configuration" pocket-id | [GIN] 2024/12/13 - 00:11:43 | 200 | 1.767963ms | 127.0.0.1 | GET "/api/application-configuration" pocket-id | [GIN] 2024/12/13 - 00:11:43 | 401 | 52.04µs | 127.0.0.1 | GET "/api/users/me" pocket-id | Error #01: You are not signed in pocket-id | [GIN] 2024/12/13 - 00:11:43 | 401 | 92.88µs | 127.0.0.1 | GET "/api/users/me" pocket-id | Error #01: You are not signed in pocket-id | [GIN] 2024/12/13 - 00:11:43 | 200 | 629.001µs | 127.0.0.1 | GET "/api/application-configuration" pocket-id | [GIN] 2024/12/13 - 00:11:43 | 200 | 678.361µs | 127.0.0.1 | GET "/api/application-configuration" pocket-id | pocket-id | 2024/12/13 00:11:48 /app/backend/internal/service/user_service.go:115 failed to encode args[1]: unable to encode 1734048708 into binary format for timestamptz (OID 1184): cannot find encode plan pocket-id | [0.919ms] [rows:0] SELECT * FROM "one_time_access_tokens" WHERE token = $1$ AND expires_at > $2$ ORDER BY "one_time_access_tokens"."id" LIMIT $3$ pocket-id | [GIN] 2024/12/13 - 00:11:48 | 500 | 1.111162ms | 2003:df:bf0a:a800::18cb | POST "/api/one-time-access-token/Zk98d00afyhxUjFk" pocket-id | Error #01: failed to encode args[1]: unable to encode 1734048708 into binary format for timestamptz (OID 1184): cannot find encode plan pocket-id | [GIN] 2024/12/13 - 00:11:48 | 500 | 1.139082ms | 2003:df:bf0a:a800::18cb | POST "/api/one-time-access-token/Zk98d00afyhxUjFk" pocket-id | Error #01: failed to encode args[1]: unable to encode 1734048708 into binary format for timestamptz (OID 1184): cannot find encode plan pocket-id | 2024-12-13 00:11:48.601837631 +0000 UTC m=+719.621563407 write error: can't make directories for new logfile: mkdir /var/log/caddy: permission denied pocket-id | [GIN] 2024/12/13 - 00:12:13 | 401 | 375.04µs | 127.0.0.1 | GET "/api/users/me" pocket-id | Error #01: You are not signed in pocket-id | [GIN] 2024/12/13 - 00:12:13 | 401 | 449.481µs | 127.0.0.1 | GET "/api/users/me" pocket-id | Error #01: You are not signed in pocket-id | [GIN] 2024/12/13 - 00:12:13 | 200 | 1.162721ms | 127.0.0.1 | GET "/api/application-configuration" pocket-id | [GIN] 2024/12/13 - 00:12:13 | 200 | 1.211441ms | 127.0.0.1 | GET "/api/application-configuration" pocket-id | [GIN] 2024/12/13 - 00:12:13 | 401 | 51.52µs | 127.0.0.1 | GET "/api/users/me" pocket-id | Error #01: You are not signed in pocket-id | [GIN] 2024/12/13 - 00:12:13 | 401 | 155.601µs | 127.0.0.1 | GET "/api/users/me" pocket-id | Error #01: You are not signed in pocket-id | [GIN] 2024/12/13 - 00:12:13 | 200 | 565.841µs | 127.0.0.1 | GET "/api/application-configuration" pocket-id | [GIN] 2024/12/13 - 00:12:13 | 200 | 614.561µs | 127.0.0.1 | GET "/api/application-configuration"
OVERLORD added the bug label 2025-10-07 00:14:49 +03:00
Author
Owner

@simono41 commented on GitHub:

If it helps to solve the problem, there is a similar problem in another GO project.

https://github.com/lib/pq/issues/1176

https://github.com/lib/pq/pull/1177

@simono41 commented on GitHub: If it helps to solve the problem, there is a similar problem in another GO project. https://github.com/lib/pq/issues/1176 https://github.com/lib/pq/pull/1177
Author
Owner

@simono41 commented on GitHub:

Oh, very important, I use the PostgreSQL database instead of SQLite.

@simono41 commented on GitHub: Oh, very important, I use the PostgreSQL database instead of SQLite.
Author
Owner

@stonith404 commented on GitHub:

Thanks for reporting this issue :) This should be fixed in v0.20.1.

The problem was that the queries used to read data from a Postgres table used the unix timestamp to filter for rows instead of the timestamptz.

@stonith404 commented on GitHub: Thanks for reporting this issue :) This should be fixed in `v0.20.1`. The problem was that the queries used to read data from a Postgres table used the unix timestamp to filter for rows instead of the timestamptz.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/pocket-id#434