[GH-ISSUE #263] [db] sql: Scan error on column index 0, name \"SUM(Size)\": converting NULL to int64 is unsupported", mailpit | panic: runtime error: integer divide by zero #174

Closed
opened 2026-03-15 13:00:34 +03:00 by kerem · 4 comments
Owner

Originally created by @alexszilagyi on GitHub (Mar 9, 2024).
Original GitHub issue: https://github.com/axllent/mailpit/issues/263

Hi there,

I have encountered the following issue:

mailpit         | time="2024/03/09 06:40:08" level=error msg="[db] sql: Scan error on column index 0, name \"SUM(Size)\": converting NULL to int64 is unsupported"
mailpit         | panic: runtime error: integer divide by zero
mailpit         | 
mailpit         | goroutine 6 [running]:
mailpit         | github.com/axllent/mailpit/internal/storage.dbCron()
mailpit         | 	/app/internal/storage/cron.go:30 +0x18f
mailpit         | created by github.com/axllent/mailpit/internal/storage.InitDB in goroutine 1
mailpit         | 	/app/internal/storage/database.go:94 +0x4a5
mailpit exited with code 2

It seems that the issues is somewhere at those lines:
https://github.com/axllent/mailpit/blob/develop/internal/storage/cron.go#L30

github.com/axllent/mailpit@bdea197a0f/internal/storage/migrations.go (L108)

github.com/axllent/mailpit@bdea197a0f/internal/storage/settings.go (L56)

Any ideas how to fix this?

I am using the latest version of mailpit. axllent/mailpit:latest docker image, with the following config:

   image: axllent/mailpit:latest
    container_name: mailpit
    environment:
       - TZ=Europe/Bucharest
       - MP_DATA_FILE=/data/mailpit.db
       - MP_UI_BIND_ADDR=0.0.0.0:9025
       - MP_SMTP_BIND_ADDR=0.0.0.0:1025
       - MP_MAX_MESSAGES=0
Originally created by @alexszilagyi on GitHub (Mar 9, 2024). Original GitHub issue: https://github.com/axllent/mailpit/issues/263 Hi there, I have encountered the following issue: ``` mailpit | time="2024/03/09 06:40:08" level=error msg="[db] sql: Scan error on column index 0, name \"SUM(Size)\": converting NULL to int64 is unsupported" mailpit | panic: runtime error: integer divide by zero mailpit | mailpit | goroutine 6 [running]: mailpit | github.com/axllent/mailpit/internal/storage.dbCron() mailpit | /app/internal/storage/cron.go:30 +0x18f mailpit | created by github.com/axllent/mailpit/internal/storage.InitDB in goroutine 1 mailpit | /app/internal/storage/database.go:94 +0x4a5 mailpit exited with code 2 ``` It seems that the issues is somewhere at those lines: https://github.com/axllent/mailpit/blob/develop/internal/storage/cron.go#L30 https://github.com/axllent/mailpit/blob/bdea197a0fbf384c8ec4fc3631d58242f8cc5e06/internal/storage/migrations.go#L108 https://github.com/axllent/mailpit/blob/bdea197a0fbf384c8ec4fc3631d58242f8cc5e06/internal/storage/settings.go#L56 Any ideas how to fix this? I am using the latest version of mailpit. `axllent/mailpit:latest` docker image, with the following config: ``` image: axllent/mailpit:latest container_name: mailpit environment: - TZ=Europe/Bucharest - MP_DATA_FILE=/data/mailpit.db - MP_UI_BIND_ADDR=0.0.0.0:9025 - MP_SMTP_BIND_ADDR=0.0.0.0:1025 - MP_MAX_MESSAGES=0 ```
kerem closed this issue 2026-03-15 13:00:40 +03:00
Author
Owner

@axllent commented on GitHub (Mar 9, 2024):

Can you please tell me when this error happens... Is it immediately when Mailpit is started, or after running for 5 minutes?

<!-- gh-comment-id:1986937682 --> @axllent commented on GitHub (Mar 9, 2024): Can you please tell me when this error happens... Is it immediately when Mailpit is started, or after running for 5 minutes?
Author
Owner

@alexszilagyi commented on GitHub (Mar 9, 2024):

@axllent I am using in a CI/CD pipeline, after a certain amount of time. Can’t tell you exactly sure. Definitely not immediately

<!-- gh-comment-id:1986940997 --> @alexszilagyi commented on GitHub (Mar 9, 2024): @axllent I am using in a CI/CD pipeline, after a certain amount of time. Can’t tell you exactly sure. Definitely not immediately
Author
Owner

@axllent commented on GitHub (Mar 9, 2024):

I have just released a new version which should fix this error. Once you have updated it should be fairly easy to test - after 5 minutes of inactivity (ie: not using Mailpit) it runs a background process (which was crashing in your case). If Mailpit doesn't crash after 5 minutes of inactivity then it is fixed 👍

<!-- gh-comment-id:1986954646 --> @axllent commented on GitHub (Mar 9, 2024): I have just released a new version which should fix this error. Once you have updated it should be fairly easy to test - after 5 minutes of inactivity (ie: not using Mailpit) it runs a background process (which was crashing in your case). If Mailpit doesn't crash after 5 minutes of inactivity then it is fixed :+1:
Author
Owner

@alexszilagyi commented on GitHub (Mar 11, 2024):

Thank you @axllent , I can confirm that its fixed in v1.14.3.

<!-- gh-comment-id:1989189836 --> @alexszilagyi commented on GitHub (Mar 11, 2024): Thank you @axllent , I can confirm that its fixed in [v1.14.3](https://github.com/axllent/mailpit/releases/tag/v1.14.3).
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/mailpit#174
No description provided.