Skip to content

fix(sync): tolerate PERMANENTFLAGS IMAP errors#13178

Open
niklasarnitz wants to merge 1 commit into
nextcloud:mainfrom
niklasarnitz:fix/permflags-imap-errors
Open

fix(sync): tolerate PERMANENTFLAGS IMAP errors#13178
niklasarnitz wants to merge 1 commit into
nextcloud:mainfrom
niklasarnitz:fix/permflags-imap-errors

Conversation

@niklasarnitz

@niklasarnitz niklasarnitz commented Jun 29, 2026

Copy link
Copy Markdown

Summary

  • Treat IMAP STATUS PERMANENTFLAGS failures as custom flags being unsupported instead of aborting account sync
  • Log the server failure at debug level with mailbox context
  • Add unit coverage for the fallback

Motivation

Some IMAP servers can return an error for the PERMANENTFLAGS status query while regular mailbox sync otherwise works. On iCloud this causes account sync to abort with Could not get message flag options from IMAP: IMAP error reported by server and can also trigger the log spam reported in #12506.

If the server cannot report permanent flag support, Mail can safely continue with custom keyword sync disabled for that mailbox.

Fixes #12506

Treat IMAP STATUS PERMANENTFLAGS failures as custom flags being unsupported instead of aborting account synchronization. Some servers, including iCloud, can fail this status query while regular mailbox sync otherwise works.

Fixes: nextcloud#12506

Assisted-by: Amp:gpt-5-codex
Signed-off-by: Niklas Arnitz <narnitz@churchtools.de>
Amp-Thread-ID: https://ampcode.com/threads/T-019f140d-88ab-73ec-bbae-9b54eec909f1
Co-authored-by: Amp <amp@ampcode.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: fad1196795

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

'mailbox' => $mailbox,
]);

return false;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Re-throw transient IMAP failures instead

If status() fails with a transient Horde exception such as SERVER_READERROR or DISCONNECT, this now downgrades the failure to “permflags unsupported”. In the tag/untag path (tagMessagesWithClient()), that makes the caller skip the IMAP addFlag/removeFlag block but still update tagMapper locally, so a user-visible tag change can be reported as successful even though the server was not updated. Please only suppress the specific PERMANENTFLAGS server response this fix targets and keep connection/authentication failures propagating.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Error "Undefined array key "id""

1 participant