nextcloud/server · error · InvalidArgumentException

User <$userOrigin> has no calendar named <$name>. You can ru

Error message

User <$userOrigin> has no calendar named <$name>. You can run occ dav:list-calendars to list calendars URIs for this user.

What it means

Thrown by occ dav:move-calendar when CalDavBackend::getCalendarByUri('principals/users/<sourceuid>', $name) returns null: the source user has no calendar with that URI. The name argument must be the calendar URI (the dav:list-calendars output), not the display name. Nothing is moved.

Source

Thrown at apps/dav/lib/Command/MoveCalendar.php:80

		$userDestination = $input->getArgument('destinationuid');

		$this->io = new SymfonyStyle($input, $output);

		if (!$this->userManager->userExists($userOrigin)) {
			throw new \InvalidArgumentException("User <$userOrigin> is unknown.");
		}

		if (!$this->userManager->userExists($userDestination)) {
			throw new \InvalidArgumentException("User <$userDestination> is unknown.");
		}

		$name = $input->getArgument('name');
		$newName = null;

		$calendar = $this->calDav->getCalendarByUri(self::URI_USERS . $userOrigin, $name);

		if ($calendar === null) {
			throw new \InvalidArgumentException("User <$userOrigin> has no calendar named <$name>. You can run occ dav:list-calendars to list calendars URIs for this user.");
		}

		// Calendar already exists
		if ($this->calendarExists($userDestination, $name)) {
			if ($input->getOption('force')) {
				// Try to find a suitable name
				$newName = $this->getNewCalendarName($userDestination, $name);

				// If we didn't find a suitable value after all the iterations, give up
				if ($this->calendarExists($userDestination, $newName)) {
					throw new \InvalidArgumentException("Unable to find a suitable calendar name for <$userDestination> with initial name <$name>.");
				}
			} else {
				throw new \InvalidArgumentException("User <$userDestination> already has a calendar named <$name>.");
			}
		}

		$hadShares = $this->checkShares($calendar, $userOrigin, $userDestination, $input->getOption('force'));

View on GitHub (pinned to ecdeb153ff)

Solutions

  1. Run `occ dav:list-calendars <sourceuid>` and use the exact URI column value
  2. Quote the name in the shell to avoid globbing/whitespace issues
  3. If the calendar is a subscription, note that move-calendar handles calendars only — move it via create/delete subscription

Example fix

# before
occ dav:move-calendar alice bob Work
# User <alice> has no calendar named <Work>. You can run occ dav:list-calendars ...

# after
occ dav:list-calendars alice
# URI: ...
# work-1
occ dav:move-calendar alice bob work-1
Defensive patterns

Strategy: validation

Validate before calling

#!/usr/bin/env bash
src="$1"; dst="$2"; name="$3"
if ! occ dav:list-calendars "$src" | awk 'NR>1 {print $1}' | grep -Fxq "$name"; then
  echo "Calendar '$name' not found for $src" >&2; exit 1
fi
occ dav:move-calendar "$src" "$dst" "$name"

Prevention

When it happens

Trigger: `occ dav:move-calendar <src> <dst> <name>` where name is the display name instead of the URI, has a typo, or the calendar belongs to a different user. Birthday calendars and subscriptions are not returned by getCalendarByUri for this path either.

Common situations: Admin copies 'Work' (display name) while the URI is 'work-1'; calendar already moved in a previous run; trailing whitespace or URL-encoded characters in the URI.

Related errors


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