nextcloud/server · error · ShareNotFound
Invalid sharee cloud id
Error message
Invalid sharee cloud id
What it means
OCP\Share\Exceptions\ShareNotFound thrown by CalendarFederationProvider::handleSyncCalendarNotification() when ICloudIdManager::resolveCloudId() rejects the 'shareWith' value with an InvalidArgumentException. A cloud id must be well-formed (user plus remote address); anything unparseable is converted into ShareNotFound so the OCS layer answers as an unknown share rather than a protocol error.
Source
Thrown at apps/dav/lib/CalDAV/Federation/CalendarFederationProvider.php:218
* @throws ShareNotFound If the notification is not related to a known share.
*/
private function handleSyncCalendarNotification(array $notification): array {
$sharedSecret = $notification['sharedSecret'];
$shareWithRaw = $notification[CalendarFederationNotifier::PROP_SYNC_CALENDAR_SHARE_WITH] ?? null;
$calendarUrl = $notification[CalendarFederationNotifier::PROP_SYNC_CALENDAR_CALENDAR_URL] ?? null;
if ($shareWithRaw === null || $shareWithRaw === '') {
throw new BadRequestException([CalendarFederationNotifier::PROP_SYNC_CALENDAR_SHARE_WITH]);
}
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(),
]);
}
View on GitHub (pinned to ecdeb153ff)
Solutions
- Send the full cloud id (e.g. user@cloud.example.com) in 'shareWith', exactly as returned by ICloudIdManager on the remote side.
- Trim/validate the value client-side before sending the notification.
- Use ICloudIdManager::resolveCloudId() locally first to confirm the id parses.
- Treat ShareNotFound responses as sender-side data errors; do not retry the identical payload.
Example fix
// before
$notification['shareWith'] = 'alice';
// after
try {
$this->cloudIdManager->resolveCloudId($shareWith);
$notification['shareWith'] = $shareWith; // e.g. 'alice@cloud.example.com'
} catch (\InvalidArgumentException $e) {
// fix or reject the cloud id before sending
} Defensive patterns
Strategy: try-catch
Validate before calling
try {
$cloudId = $this->cloudIdManager->resolveCloudId($shareWith);
} catch (\InvalidArgumentException $e) {
// malformed cloud id: do not send the notification
return;
} Try / catch
try {
$provider->notificationReceived('SYNC_CALENDAR', 'calendar', $notification);
} catch (\OCP\Share\Exceptions\ShareNotFound $e) {
// 'Invalid sharee cloud id': fix shareWith format (user@host) before retrying
} Prevention
- Send full federated cloud ids (user@host), never bare usernames.
- Validate with ICloudIdManager::resolveCloudId() before dispatching federation notifications.
When it happens
Trigger: Sending a SYNC_CALENDAR notification whose shareWith is not a valid cloud id string (missing the user@host shape, stray whitespace, or an empty scheme), causing resolveCloudId() to throw InvalidArgumentException.
Common situations: Sending a bare username instead of the full federated cloud id; copy-paste artifacts (trailing slash, spaces) in the shareWith field; lookups on servers where the cloud id could not be normalized; tests using 'user' instead of 'user@server'.
Related errors
- Parameters missing in order to complete the request. Missing
- Parameters missing in order to complete the request. Missing
- Parameters missing in order to complete the request. Missing
- Calendar is not shared with the sharee
- Could not create new calendar event: {message}
AI-assisted analysis of nextcloud/server@ecdeb153ff (2026-08-17).
Data as JSON: /api/errors/872b872947dc94b4.
Report an issue: GitHub.