Skip to content

Contacts fail silently when count exceeds maxObjectsInGet #45

@capitanroy

Description

@capitanroy

Description

When the JMAP server has more contacts than maxObjectsInGet (advertised in session capabilities), the contacts page shows "No contacts yet" with no error message. The user has no indication that contacts exist but can't be loaded.

Steps to reproduce

  1. Have a Stalwart JMAP server with maxObjectsInGet: 500 (the default)
  2. Sync 500+ contacts into the address book (e.g., from a CRM)
  3. Open Shell → Contacts
  4. Expected: Contacts are displayed (paginated if needed)
  5. Actual: "No contacts yet" — empty state, no error in console

Root cause

getContacts() in the JMAP client does:

ContactCard/query   limit: 1000   returns N ids
ContactCard/get     #ids back-reference  requests all N at once

When N exceeds maxObjectsInGet, Stalwart returns a requestTooLarge error for the ContactCard/get call. The error is caught silently and the contacts store receives an empty array.

Two issues

  1. No batching: ContactCard/get should respect maxObjectsInGet from session.capabilities["urn:ietf:params:jmap:core"] and split requests into batches. Per RFC 8620 §5.1, clients should not exceed this limit.

  2. Silent failure: When ContactCard/get returns a method-level error, getContacts() returns [] instead of surfacing the error. The fetchContacts store handler catches the exception but the JMAP error path returns empty data without throwing.

Environment

  • JMAP web-mail v1.3.3
  • Stalwart Mail Server (latest, default config: maxObjectsInGet: 500)
  • ~600 contacts in address book

Workaround

Increase Stalwart's maxObjectsInGet in config:

[jmap.protocol]
get.max-objects = 100000

This works but doesn't fix the client-side issue — jmap-webmail should handle this gracefully regardless of server limits.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions