{"record":{"id":"872b872947dc94b4","repo":"nextcloud/server","slug":"invalid-sharee-cloud-id","errorCode":null,"errorMessage":"Invalid sharee cloud id","messagePattern":"Invalid sharee cloud id","errorType":"http","errorClass":"ShareNotFound","httpStatus":400,"severity":"error","filePath":"apps/dav/lib/CalDAV/Federation/CalendarFederationProvider.php","lineNumber":218,"sourceCode":"\t * @throws ShareNotFound If the notification is not related to a known share.\n\t */\n\tprivate function handleSyncCalendarNotification(array $notification): array {\n\t\t$sharedSecret = $notification['sharedSecret'];\n\t\t$shareWithRaw = $notification[CalendarFederationNotifier::PROP_SYNC_CALENDAR_SHARE_WITH] ?? null;\n\t\t$calendarUrl = $notification[CalendarFederationNotifier::PROP_SYNC_CALENDAR_CALENDAR_URL] ?? null;\n\n\t\tif ($shareWithRaw === null || $shareWithRaw === '') {\n\t\t\tthrow new BadRequestException([CalendarFederationNotifier::PROP_SYNC_CALENDAR_SHARE_WITH]);\n\t\t}\n\n\t\tif ($calendarUrl === null || $calendarUrl === '') {\n\t\t\tthrow new BadRequestException([CalendarFederationNotifier::PROP_SYNC_CALENDAR_CALENDAR_URL]);\n\t\t}\n\n\t\ttry {\n\t\t\t$shareWith = $this->cloudIdManager->resolveCloudId($shareWithRaw);\n\t\t} catch (\\InvalidArgumentException $e) {\n\t\t\tthrow new ShareNotFound('Invalid sharee cloud id');\n\t\t}\n\n\t\t$calendars = $this->federatedCalendarMapper->findByRemoteUrl(\n\t\t\t$calendarUrl,\n\t\t\t'principals/users/' . $shareWith->getUser(),\n\t\t\t$sharedSecret,\n\t\t\tFederatedCalendarEntity::STATE_ACCEPTED,\n\t\t);\n\t\tif (empty($calendars)) {\n\t\t\tthrow new ShareNotFound('Calendar is not shared with the sharee');\n\t\t}\n\n\t\tforeach ($calendars as $calendar) {\n\t\t\t$this->jobList->add(FederatedCalendarSyncJob::class, [\n\t\t\t\tFederatedCalendarSyncJob::ARGUMENT_ID => $calendar->getId(),\n\t\t\t]);\n\t\t}\n","sourceCodeStart":200,"sourceCodeEnd":236,"githubUrl":"https://github.com/nextcloud/server/blob/ecdeb153ffdf227235c9a7e2d13dbe0f9c817bc3/apps/dav/lib/CalDAV/Federation/CalendarFederationProvider.php#L200-L236","documentation":"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.","triggerScenarios":"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.","commonSituations":"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'.","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."],"exampleFix":"// before\n$notification['shareWith'] = 'alice';\n\n// after\ntry {\n\t$this->cloudIdManager->resolveCloudId($shareWith);\n\t$notification['shareWith'] = $shareWith; // e.g. 'alice@cloud.example.com'\n} catch (\\InvalidArgumentException $e) {\n\t// fix or reject the cloud id before sending\n}","handlingStrategy":"try-catch","validationCode":"try {\n    $cloudId = $this->cloudIdManager->resolveCloudId($shareWith);\n} catch (\\InvalidArgumentException $e) {\n    // malformed cloud id: do not send the notification\n    return;\n}","typeGuard":null,"tryCatchPattern":"try {\n    $provider->notificationReceived('SYNC_CALENDAR', 'calendar', $notification);\n} catch (\\OCP\\Share\\Exceptions\\ShareNotFound $e) {\n    // 'Invalid sharee cloud id': fix shareWith format (user@host) before retrying\n}","preventionTips":["Send full federated cloud ids (user@host), never bare usernames.","Validate with ICloudIdManager::resolveCloudId() before dispatching federation notifications."],"tags":["caldav","calendar","federation","cloud-id","share-not-found","notification"],"backgroundTag":"invalid-cloud-id","analyzedSha":"ecdeb153ffdf227235c9a7e2d13dbe0f9c817bc3","analyzedAt":"2026-08-17T01:36:13.386Z","schemaVersion":2},"datasetVersion":"2026-08-17T04:17:16.089Z"}