nextcloud/server · error · InvalidArgumentException

User <$user> is unknown.

Error message

User <$user> is unknown.

What it means

InvalidArgumentException from the occ dav:delete-calendar command when the required uid argument does not match an existing user. It aborts before resolving the birthday option or the calendar name.

Source

Thrown at apps/dav/lib/Command/DeleteCalendar.php:64

			->addOption('birthday',
				null,
				InputOption::VALUE_NONE,
				'Delete the birthday calendar')
			->addOption('force',
				'f',
				InputOption::VALUE_NONE,
				'Force delete skipping trashbin');
	}

	#[\Override]
	protected function execute(
		InputInterface $input,
		OutputInterface $output,
	): int {
		/** @var string $user */
		$user = $input->getArgument('uid');
		if (!$this->userManager->userExists($user)) {
			throw new \InvalidArgumentException(
				'User <' . $user . '> is unknown.');
		}

		$birthday = $input->getOption('birthday');
		if ($birthday !== false) {
			$name = BirthdayService::BIRTHDAY_CALENDAR_URI;
		} else {
			/** @var string $name */
			$name = $input->getArgument('name');
			if (!$name) {
				throw new \InvalidArgumentException(
					'Please specify a calendar name or --birthday');
			}
		}

		$calendarInfo = $this->calDav->getCalendarByUri(
			'principals/users/' . $user,
			$name);

View on GitHub (pinned to ecdeb153ff)

Solutions

  1. Confirm the id with occ user:list (or occ user:info <uid>) and re-run
  2. Run cleanup before deleting the user, or skip already-deleted users in scripts
  3. Quote the uid to avoid shell interpretation of dots or dashes

Example fix

# before
occ dav:delete-calendar jdoe_example personal
# after
occ user:list
occ dav:delete-calendar jdoe personal
Defensive patterns

Strategy: validation

Validate before calling

#!/bin/bash
uid="$1"
occ user:info "$uid" >/dev/null 2>&1 || { echo "unknown user: $uid" >&2; exit 1; }
occ dav:delete-calendar "$uid" "$2"

Prevention

When it happens

Trigger: occ dav:delete-calendar <uid> [<name>] [--birthday] [--force] with a uid that is misspelled, deleted, or given as an email address.

Common situations: Cleanup scripts run after users were already deleted; copy-pasted uids from another environment; case mismatches in LDAP-backed ids.

Related errors


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