nextcloud/server · error · InvalidArgumentException

User <$userOrigin> is unknown.

Error message

User <$userOrigin> is unknown.

What it means

First user guard in occ dav:move-calendar: the sourceuid argument (the user who currently owns the calendar) fails IUserManager::userExists(). It fires before the destination check and before any calendar lookup, so no data is touched. The move transfers calendar ownership between two existing users, and both endpoints are validated first.

Source

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

				'Name of the calendar to move')
			->addArgument('sourceuid',
				InputArgument::REQUIRED,
				'User who currently owns the calendar')
			->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')) {

View on GitHub (pinned to ecdeb153ff)

Solutions

  1. Confirm both uids with `occ user:info <sourceuid>` and `occ user:info <destinationuid>`
  2. Re-run with the corrected source uid
  3. If migrating away from a deleted user, restore the account first or move data via calendar export/import instead
Defensive patterns

Strategy: validation

Validate before calling

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

Prevention

When it happens

Trigger: `occ dav:move-calendar <sourceuid> <destinationuid> <name>` with a source uid that is typo'd or deleted.

Common situations: User was deleted before the migration ran; copy-paste of the wrong uid during account consolidation; LDAP user not resolved at run time.

Related errors


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