monicahq/monica · error · DavServerNotCompliantException
Server does not support rfc 5397 section 3 (DAV:current-user
Error message
Server does not support rfc 5397 section 3 (DAV:current-user-principal)
What it means
During principal discovery, getAddressBookForUri() issues a PROPFIND for {DAV:}current-user-principal on the given URI. RFC 5397 section 3 requires servers to return this property so clients can bootstrap from any URL to the user's principal. When getProperty returns null or empty (404 propstat, or an unauthenticated response that hides the principal), this DavServerNotCompliantException is thrown.
Source
Thrown at app/Domains/Contact/DavClient/Services/Utils/AddressBookGetter.php:171
if (! in_array('1', $options) || ! in_array('3', $options) || ($addressbook && ! in_array('addressbook', $options))) {
throw new DavServerNotCompliantException('server is not compliant with rfc2518 section 15.1, or rfc6352 section 6.1');
}
}
/**
* Get principal name.
*
* @see https://datatracker.ietf.org/doc/html/rfc5397#section-3
*
* @throws DavServerNotCompliantException
*/
private function getCurrentUserPrincipal(string $uri = ''): string
{
$prop = $this->client->getProperty('{DAV:}current-user-principal', $uri);
if (is_null($prop) || empty($prop)) {
throw new DavServerNotCompliantException('Server does not support rfc 5397 section 3 (DAV:current-user-principal)');
} elseif (is_string($prop)) {
return $prop;
}
return $prop[0]['value'];
}
/**
* Get addressbook url.
*
* @see https://datatracker.ietf.org/doc/html/rfc6352#section-7.1.1
*
* @throws DavServerNotCompliantException
*/
private function getAddressBookHome(string $principal): string
{
$prop = $this->client->getProperty('{'.CardDav::NS_CARDDAV.'}addressbook-home-set', $principal);
View on GitHub (pinned to e08e917341)
Solutions
- Point base_uri directly at the address book collection URL so the earlier resourcetype walk succeeds and principal discovery is never needed
- Verify the property manually with an authenticated PROPFIND asking for current-user-principal on the URI and confirm the response contains an href
- Confirm authentication is sent and accepted on the discovery request (unauthenticated servers may omit the property)
- Upgrade the remote CardDAV server to an RFC 5397-compliant version
Defensive patterns
Strategy: validation
Validate before calling
// Preflight: confirm the server returns {DAV:}current-user-principal for an authenticated PROPFIND
$prop = $davClient->getProperty('{DAV:}current-user-principal', $uri);
if (is_null($prop) || empty($prop)) {
throw ValidationException::withMessages([
'base_uri' => 'Server does not support RFC 5397 principal discovery; supply the direct address book URL.',
]);
} Try / catch
use App\Domains\Contact\DavClient\Services\Utils\Dav\DavServerNotCompliantException;
try {
app(CreateAddressBookSubscription::class)->execute($data);
} catch (DavServerNotCompliantException $e) {
if (str_contains($e->getMessage(), 'rfc 5397')) {
// fall back: ask the user for the exact address book collection URL
}
throw $e;
} Prevention
- When the server lacks RFC 5397, configure the address book collection URL directly so the resourcetype path walk succeeds without principal discovery
- Ensure discovery requests carry credentials — some servers omit the principal property when anonymous
- Upgrade non-compliant CardDAV servers rather than working around them
- Log the failing URI in observability output to distinguish which discovery step threw
When it happens
Trigger: A Depth-0 PROPFIND on the supplied URI does not return {DAV:}current-user-principal: older or non-standard CardDAV servers, servers that only reveal the principal to authenticated requests while the request went out unauthenticated, or a base_uri that routes to a plain web page instead of a DAV endpoint.
Common situations: base_uri pointing at the server's login page or web root rather than the DAV endpoint, a CardDAV server predating RFC 5397, or rejected credentials so the server answers without principal information.
Related errors
- No address book found
- Server does not support rfc 6352 section 7.1.1 (CARD:address
- Could not get address book data.
- server is not compliant with rfc2518 section 15.1, or rfc635
AI-assisted analysis of monicahq/monica@e08e917341 (2026-08-17).
Data as JSON: /api/errors/d3959c4ee6330f55.
Report an issue: GitHub.