nextcloud/server · warning · ShareNotFound
Calendar is not shared with the sharee
Error message
Calendar is not shared with the sharee
What it means
OCP\Share\Exceptions\ShareNotFound thrown by CalendarFederationProvider::handleSyncCalendarNotification() when FederatedCalendarMapper::findByRemoteUrl() returns nothing for the given calendarUrl, principals/users/<sharee>, sharedSecret and state STATE_ACCEPTED. All four conditions must match a stored federated calendar entity, so a mismatch in url, user, token/secret, or an unaccepted (pending/declined) share yields this error. Success instead queues FederatedCalendarSyncJob per matched calendar.
Source
Thrown at apps/dav/lib/CalDAV/Federation/CalendarFederationProvider.php:228
if ($calendarUrl === null || $calendarUrl === '') {
throw new BadRequestException([CalendarFederationNotifier::PROP_SYNC_CALENDAR_CALENDAR_URL]);
}
try {
$shareWith = $this->cloudIdManager->resolveCloudId($shareWithRaw);
} catch (\InvalidArgumentException $e) {
throw new ShareNotFound('Invalid sharee cloud id');
}
$calendars = $this->federatedCalendarMapper->findByRemoteUrl(
$calendarUrl,
'principals/users/' . $shareWith->getUser(),
$sharedSecret,
FederatedCalendarEntity::STATE_ACCEPTED,
);
if (empty($calendars)) {
throw new ShareNotFound('Calendar is not shared with the sharee');
}
foreach ($calendars as $calendar) {
$this->jobList->add(FederatedCalendarSyncJob::class, [
FederatedCalendarSyncJob::ARGUMENT_ID => $calendar->getId(),
]);
}
return [];
}
/**
* @return array{0: CalendarFederationProtocolV1, 1: string, 2: string, 3: ?string, 4: int, 5: string}|null
* [parsed protocol, calendarUrl, displayName, color, access, components], or null when
* the envelope cannot be parsed (missing/unsupported version, parse error).
*/
private function parseShare(ICloudFederationShare $share): ?array {
$rawProtocol = $share->getProtocol();View on GitHub (pinned to ecdeb153ff)
Solutions
- Ensure the sharee has accepted the federated calendar (STATE_ACCEPTED) before sending SYNC_CALENDAR notifications.
- Send the exact calendarUrl used when the share was created and the current sharedSecret from the share.
- Re-check the stored entity via FederatedCalendarMapper (remote url, principal, token, state) when debugging.
- Delay/retry the notification after the sharee accepts; treat ShareNotFound as 'not ready' rather than a hard failure.
Defensive patterns
Strategy: retry
Validate before calling
// before notifying, confirm an accepted federated calendar exists for the tuple
$calendars = $this->federatedCalendarMapper->findByRemoteUrl(
$calendarUrl,
'principals/users/' . $shareeUser,
$sharedSecret,
\OCA\DAV\CalDAV\Federation\FederatedCalendarEntity::STATE_ACCEPTED,
);
if ($calendars === []) {
// share not accepted yet (or url/secret mismatch); skip the notification
return;
} Try / catch
try {
$provider->notificationReceived('SYNC_CALENDAR', 'calendar', $notification);
} catch (\OCP\Share\Exceptions\ShareNotFound $e) {
// share missing/pending/mismatched: re-check acceptance and current secret, then retry once
} Prevention
- Only send SYNC_CALENDAR after the sharee accepted the share.
- Keep the sharedSecret in lockstep with the latest re-share of the calendar.
- Treat ShareNotFound as a state problem (pending/mismatch), not a transport failure; verify state before retrying.
When it happens
Trigger: Sending a SYNC_CALENDAR notification for a share that is still STATE_PENDING (invite not accepted); using a calendarUrl different from the one the share was created with; a sharedSecret that no longer matches the stored token; targeting a sharee user that does not own the federated calendar row.
Common situations: Sharer's server sends a sync ping before the sharee accepted; share re-sent which rotated the secret while the old notification was in flight; user renamed or the calendar re-shared under a new url; clock/ordering races between acceptance and first sync.
Related errors
- Parameters missing in order to complete the request. Missing
- Parameters missing in order to complete the request. Missing
- Invalid sharee cloud id
- Parameters missing in order to complete the request. Missing
- RESOURCE_NOT_FOUND
AI-assisted analysis of nextcloud/server@ecdeb153ff (2026-08-17).
Data as JSON: /api/errors/97d2cfe9e5ddf1ad.
Report an issue: GitHub.