Skip to content

fix: truncate error message in backup notifications to 1010 characters#4023

Merged
Siumauricio merged 2 commits intocanaryfrom
4021-discord-error-notifications-fail-due-to-content-exceeding-max-embed-length
Mar 18, 2026
Merged

fix: truncate error message in backup notifications to 1010 characters#4023
Siumauricio merged 2 commits intocanaryfrom
4021-discord-error-notifications-fail-due-to-content-exceeding-max-embed-length

Conversation

@Siumauricio
Copy link
Contributor

@Siumauricio Siumauricio commented Mar 18, 2026

  • Updated the error message formatting in both database and volume backup notification functions to limit the displayed message length, ensuring better readability and preventing overflow.

What is this PR about?

Please describe in a short paragraph what this PR is about.

Checklist

Before submitting this PR, please make sure that:

  • You created a dedicated branch based on the canary branch.
  • You have read the suggestions in the CONTRIBUTING.md file https://github.com/Dokploy/dokploy/blob/canary/CONTRIBUTING.md#pull-request
  • You have tested this PR in your local instance. If you have not tested it yet, please do so before submitting. This helps avoid wasting maintainers' time reviewing code that has not been verified by you.

Issues related (if applicable)

closes #4021

Screenshots (if applicable)

Greptile Summary

This PR truncates the errorMessage to 1010 characters in Discord backup failure notifications for both database and volume backups, preventing Discord from rejecting embed field values that exceed its 1024-character limit (1010 content + 6 surrounding backtick characters = 1016, safely under the cap).

Key observations:

  • The Discord-specific fix is correct and addresses the reported issue (Discord error notifications fail due to content exceeding max embed length #4021).
  • The truncation is only applied to Discord; other channels such as Slack, Telegram, Pushover, Gotify, and Ntfy still receive the full, untruncated errorMessage. Pushover in particular enforces a hard 1024-character message limit, which could cause API failures for long error strings.
  • No truncation indicator (e.g. ...) is appended when the message is cut off, so Discord users have no way to tell the notification is incomplete.
  • teams and lark already had their own truncation (500 and 800 characters respectively); the fix is consistent with that pattern but only for the Discord channel.

Confidence Score: 4/5

  • Safe to merge — fixes a real Discord API overflow bug with no regressions introduced; minor completeness gaps remain for other channels.
  • The change is minimal and targeted, correctly resolves the Discord 1024-character embed field limit, and cannot break existing behaviour for other notification channels. The outstanding issues (no ... indicator, untruncated messages to Pushover/Slack/Telegram/etc.) are pre-existing gaps not introduced by this PR, though they are worth addressing in a follow-up.
  • No files require special attention; both changed files have the same pattern and the same residual concerns.

Comments Outside Diff (1)

  1. packages/server/src/utils/notifications/database-backup.ts, line 228-236 (link)

    P2 Other notification channels still send untruncated error messages

    This PR fixes truncation only for Discord. However, the same untruncated errorMessage is also passed to:

    • Slack (line 232) — Slack's legacy attachments field values have a 2000-character limit.
    • Telegram (line 208) — Telegram has a 4096-character per-message limit; a very long error message combined with the rest of the template could exceed it.
    • Pushover (line 413) — Pushover enforces a strict 1024-character message limit; a long error message here will likely cause an API error.
    • Gotify (line 183) and Ntfy (line 198) — no truncation applied either.

    For comparison, teams (line 430) and lark (lines 296–299) already apply their own truncation. The same gap exists in volume-backup.ts at the corresponding lines.

Last reviewed commit: "fix: truncate error ..."

Greptile also left 1 inline comment on this PR.

- Updated the error message formatting in both database and volume backup notification functions to limit the displayed message length, ensuring better readability and preventing overflow.
@dosubot dosubot bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Mar 18, 2026
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
@Siumauricio Siumauricio merged commit cccee05 into canary Mar 18, 2026
4 checks passed
@Siumauricio Siumauricio deleted the 4021-discord-error-notifications-fail-due-to-content-exceeding-max-embed-length branch March 18, 2026 04:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Discord error notifications fail due to content exceeding max embed length

1 participant