nextcloud/server · error · BadRequestException

Parameters missing in order to complete the request. Missing

Error message

Parameters missing in order to complete the request. Missing Parameters: shareWith

What it means

OCP\Federation\Exceptions\BadRequestException thrown by CalendarFederationProvider::handleSyncCalendarNotification() when the SYNC_CALENDAR notification array has no 'shareWith' key (CalendarFederationNotifier::PROP_SYNC_CALENDAR_SHARE_WITH) or it is an empty string. The constructor renders the missing parameter names into the message, so the receiving remote server sees which prop to add. handleSyncCalendarNotification runs for notification type 'SYNC_CALENDAR' after the providerId check passed.

Source

Thrown at apps/dav/lib/CalDAV/Federation/CalendarFederationProvider.php:208

	/**
	 * @return string[]
	 */
	#[\Override]
	public function getSupportedShareTypes(): array {
		return [self::USER_SHARE_TYPE];
	}

	/**
	 * @throws BadRequestException If notification props are missing.
	 * @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,
		);

View on GitHub (pinned to ecdeb153ff)

Solutions

  1. Include a non-empty 'shareWith' (the sharee cloud id) in the SYNC_CALENDAR notification payload.
  2. Build notifications with CalendarFederationNotifier so all required props are set consistently.
  3. On receipt of the 400, inspect the validationErrors returned via BadRequestException::getReturnMessage() to confirm which prop is missing.

Example fix

// before
$notification = ['sharedSecret' => $secret, 'calendarUrl' => $url];

// after
$notification = [
	'sharedSecret' => $secret,
	'shareWith' => $shareeCloudId,      // CalendarFederationNotifier::PROP_SYNC_CALENDAR_SHARE_WITH
	'calendarUrl' => $calendarUrl,
];
Defensive patterns

Strategy: validation

Validate before calling

use OCA\DAV\CalDAV\Federation\CalendarFederationNotifier;
$notification[CalendarFederationNotifier::PROP_SYNC_CALENDAR_SHARE_WITH] ??= null;
if (empty($notification[CalendarFederationNotifier::PROP_SYNC_CALENDAR_SHARE_WITH])) {
    throw new \InvalidArgumentException('shareWith is required for SYNC_CALENDAR notifications');
}

Try / catch

try {
    $provider->notificationReceived('SYNC_CALENDAR', 'calendar', $notification);
} catch (\OCP\Federation\Exceptions\BadRequestException $e) {
    // validationErrors from getReturnMessage() name the missing prop; add it and retry
}

Prevention

When it happens

Trigger: POSTing a cloud federation notification of type 'SYNC_CALENDAR' whose notification payload omits 'shareWith' or sends it empty; custom clients that build the sync notification by hand instead of via CalendarFederationNotifier.

Common situations: Third-party senders guessing the notification schema; protocol drift between Nextcloud versions that renamed the prop; tests with partial fixtures; payload stripped by an over-aggressive sanitizer.

Related errors


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