nextcloud/server · error · Sabre\DAV\Exception\Forbidden

AddressBook limit reached

Error message

AddressBook limit reached

What it means

After the rate check, CardDavRateLimitingPlugin enforces a hard per-user cap: it counts existing books via getAddressBooksForUserCount('principals/users/<uid>') and compares against dav maximumAdressbooks (default 10; -1 disables the check). Meeting or exceeding the cap throws Forbidden('AddressBook limit reached') (HTTP 403). Note the config key's historical typo: it is maximumAdressbooks, not maximumAddressbooks.

Source

Thrown at apps/dav/lib/CardDAV/Security/CardDavRateLimitingPlugin.php:82

					$this->config->getValueInt('dav', 'rateLimitPeriodAddressBookCreation', 3600),
					$user
				);
			} catch (RateLimitExceededException $e) {
				throw new TooManyRequests('Too many addressbooks created', 0, $e);
			}

			$addressBookLimit = $this->config->getValueInt('dav', 'maximumAdressbooks', 10);
			if ($addressBookLimit === -1) {
				return;
			}
			$numAddressbooks = $this->cardDavBackend->getAddressBooksForUserCount('principals/users/' . $user->getUID());

			if ($numAddressbooks >= $addressBookLimit) {
				$this->logger->warning('Maximum number of address books reached', [
					'addressbooks' => $numAddressbooks,
					'addressBookLimit' => $addressBookLimit,
				]);
				throw new Forbidden('AddressBook limit reached', 0);
			}
		}
	}

}

View on GitHub (pinned to ecdeb153ff)

Solutions

  1. Delete or merge unused addressbooks to get below the cap
  2. Raise the cap with the exact key: occ config:app:set dav maximumAdressbooks --value='50' ('-1' disables it)
  3. Verify the effective value: occ config:app:get dav maximumAdressbooks

Example fix

# before
MKCOL /addressbooks/users/alice/book-11/   (alice already has 10)
-> 403 AddressBook limit reached

# after
occ config:app:set dav maximumAdressbooks --value='50'
MKCOL /addressbooks/users/alice/book-11/   -> 201 Created
Defensive patterns

Strategy: validation

Validate before calling

$books = $client->propFind('/remote.php/dav/addressbooks/users/' . $user . '/', [], 1);
$count = max(0, count($books) - 1); // minus the collection itself
if ($count >= 10 /* dav maximumAdressbooks default */) {
    throw new AddressBookQuotaError('delete a book or ask the admin to raise dav maximumAdressbooks');
}

Try / catch

try {
    $client->request('MKCOL', $uri);
} catch (\Sabre\HTTP\ClientHttpException $e) {
    if ($e->getResponse()->getStatus() === 403 && str_contains($e->getMessage(), 'limit reached')) {
        // prompt the user to delete an addressbook or raise the cap
    }
}

Prevention

When it happens

Trigger: MKCOL of a new addressbook when the user already owns at least maximumAdressbooks books (default 10); scripted provisioning running past the cap.

Common situations: Power users or CRM integrations needing more than 10 books; admins setting 'maximumAddressbooks' (correctly spelled) and wondering why nothing changes; imports from other groupware.

Related errors


AI-assisted analysis of nextcloud/server@ecdeb153ff (2026-08-17). Data as JSON: /api/errors/57f8a81e0baa1319. Report an issue: GitHub.