nextcloud/server · error · InvalidArgumentException

User <$user> in unknown.

Error message

User <$user> in unknown.

What it means

Thrown by occ dav:sync-birthday-calendar when the optional user argument is provided but does not exist (IUserManager::userExists() false). The user argument is OPTIONAL: omitted, the command syncs birthday calendars for all users; the error only fires for an explicit unknown uid. Note the message itself contains a typo ('in unknown' instead of 'is unknown'). When a valid uid is passed the command also re-enables the per-user generateBirthdayCalendar flag before syncing.

Source

Thrown at apps/dav/lib/Command/SyncBirthdayCalendar.php:47

	#[\Override]
	protected function configure(): void {
		$this
			->setName('dav:sync-birthday-calendar')
			->setDescription('Synchronizes the birthday calendar')
			->addArgument('user',
				InputArgument::OPTIONAL,
				'User for whom the birthday calendar will be synchronized');
	}

	#[\Override]
	protected function execute(InputInterface $input, OutputInterface $output): int {
		$this->verifyEnabled();

		$user = $input->getArgument('user');
		if (!is_null($user)) {
			if (!$this->userManager->userExists($user)) {
				throw new \InvalidArgumentException("User <$user> in unknown.");
			}

			// re-enable the birthday calendar in case it's called directly with a user name
			$isEnabled = $this->config->getUserValue($user, 'dav', 'generateBirthdayCalendar', 'yes');
			if ($isEnabled !== 'yes') {
				$this->config->setUserValue($user, 'dav', 'generateBirthdayCalendar', 'yes');
				$output->writeln("Re-enabling birthday calendar for $user");
			}

			$output->writeln("Start birthday calendar sync for $user");
			$this->birthdayService->syncUser($user);
			return self::SUCCESS;
		}
		$output->writeln('Start birthday calendar sync for all users ...');
		$p = new ProgressBar($output);
		$p->start();
		$this->userManager->callForSeenUsers(function ($user) use ($p): void {
			$p->advance();

View on GitHub (pinned to ecdeb153ff)

Solutions

  1. Verify the uid with `occ user:info <uid>`
  2. Drop the argument to sync every user, or fix the uid and re-run
  3. For external backends, ensure the user is visible before scheduling the per-user sync
Defensive patterns

Strategy: validation

Validate before calling

#!/usr/bin/env bash
uid="$1"
if [ -n "$uid" ]; then
  occ user:info "$uid" >/dev/null 2>&1 || { echo "Unknown user: $uid" >&2; exit 1; }
fi
occ dav:sync-birthday-calendar ${uid:-}

Prevention

When it happens

Trigger: `occ dav:sync-birthday-calendar <uid>` with a typo'd or deleted user id. Running it with no argument never triggers this error.

Common situations: Cron/scripts pinned to a user that was deleted; typo; external backend user not resolved.

Related errors


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