nextcloud/server · error · InvalidArgumentException

User <$userDestination> is unknown.

Error message

User <$userDestination> is unknown.

What it means

Second user guard in occ dav:move-calendar: the destinationuid argument fails IUserManager::userExists(), while the source user already passed. Thrown before the calendar lookup, so nothing is modified. The destination is the account that will receive ownership of the calendar.

Source

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

			->addArgument('destinationuid',
				InputArgument::REQUIRED,
				'User who will receive the calendar')
			->addOption('force', 'f', InputOption::VALUE_NONE, 'Force the migration by removing existing shares and renaming calendars in case of conflicts');
	}

	#[\Override]
	protected function execute(InputInterface $input, OutputInterface $output): int {
		$userOrigin = $input->getArgument('sourceuid');
		$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

View on GitHub (pinned to ecdeb153ff)

Solutions

  1. Create the destination user first (`occ user:add ...`) or fix the typo
  2. Verify with `occ user:info <destinationuid>`
  3. Re-run the move command
Defensive patterns

Strategy: validation

Validate before calling

#!/usr/bin/env bash
src="$1"; dst="$2"; name="$3"
occ user:info "$dst" >/dev/null 2>&1 || { echo "Destination user missing: $dst" >&2; exit 1; }
occ dav:move-calendar "$src" "$dst" "$name"

Prevention

When it happens

Trigger: `occ dav:move-calendar <sourceuid> <destinationuid> <name>` where the receiving account does not exist (typo, not yet created, backend unavailable).

Common situations: Target account created later in a migration runbook than the move step; typo in destination uid; destination user deleted concurrently.

Related errors


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