nextcloud/server · error · InvalidArgumentException

User $user is unknown

Error message

User $user is unknown

What it means

Thrown by occ dav:list-subscriptions when the uid argument fails IUserManager::userExists(). The check precedes app-config reading and getSubscriptionsForUser(), so nothing is queried. Subscriptions here are remote iCalendar feeds (created via dav:create-subscription), not regular calendars.

Source

Thrown at apps/dav/lib/Command/ListSubscriptions.php:49

		private CalDavBackend $caldav,
	) {
		parent::__construct();
	}

	#[\Override]
	protected function configure(): void {
		$this->addArgument(
			'uid',
			InputArgument::REQUIRED,
			'User whose calendar subscriptions will be listed'
		);
	}

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

		$defaultRefreshRate = $this->appConfig->getValueString('dav', 'calendarSubscriptionRefreshRate', 'P1D');
		$subscriptions = $this->caldav->getSubscriptionsForUser("principals/users/$user");
		$rows = [];

		foreach ($subscriptions as $subscription) {
			$rows[] = [
				$subscription['uri'],
				$subscription['{DAV:}displayname'],
				$subscription['{http://apple.com/ns/ical/}refreshrate'] ?? ($defaultRefreshRate . ' (default)'),
				$subscription['source'],
			];
		}

		usort($rows, static fn (array $a, array $b) => $a[0] <=> $b[0]);

		if (count($rows) > 0) {

View on GitHub (pinned to ecdeb153ff)

Solutions

  1. Verify with `occ user:info <uid>`
  2. Correct the uid and re-run
  3. For external backends, ensure availability/sync before retrying
Defensive patterns

Strategy: validation

Validate before calling

#!/usr/bin/env bash
uid="$1"
occ user:info "$uid" >/dev/null 2>&1 || { echo "Unknown user: $uid" >&2; exit 1; }
occ dav:list-subscriptions "$uid"

Prevention

When it happens

Trigger: `occ dav:list-subscriptions <uid>` where uid is misspelled, deleted, or unresolved by the active user backends.

Common situations: Same-family user-validation failure as the other dav list commands: stale automation user lists, deleted accounts, external backend outages, wrong instance.

Related errors


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