nextcloud/server · error · InvalidArgumentException

User $user is unknown

Error message

User $user is unknown

What it means

InvalidArgumentException from occ dav:delete-subscription when the required uid argument does not match an existing user (userExists() returns false). The command aborts before looking up the subscription.

Source

Thrown at apps/dav/lib/Command/DeleteSubscription.php:53

	protected function configure(): void {
		$this
			->addArgument(
				'uid',
				InputArgument::REQUIRED,
				'User who owns the calendar subscription'
			)
			->addArgument(
				'uri',
				InputArgument::REQUIRED,
				'URI of the calendar to be deleted'
			);
	}

	#[\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");
		}

		$uri = (string)$input->getArgument('uri');
		if ($uri === '') {
			throw new \InvalidArgumentException('Specify the URI of the calendar to be deleted');
		}

		$subscriptionInfo = $this->calDavBackend->getSubscriptionByUri(
			'principals/users/' . $user,
			$uri
		);

		if ($subscriptionInfo === null) {
			throw new \InvalidArgumentException("User $user has no calendar subscription with the URI $uri");
		}

		$subscription = new CachedSubscription(
			$this->calDavBackend,

View on GitHub (pinned to ecdeb153ff)

Solutions

  1. Resolve the exact id via occ user:list and re-run
  2. Pre-validate with occ user:info <uid> in scripts
  3. Order cleanup before user deletion in lifecycle automation

Example fix

# before
occ dav:delete-subscription jdoe 'Company Holidays'
# after
occ user:list
occ dav:delete-subscription jdoe company-holidays
Defensive patterns

Strategy: validation

Validate before calling

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

Prevention

When it happens

Trigger: occ dav:delete-subscription <uid> <uri> with a misspelled, deleted, or email-formatted user id.

Common situations: Cleanup jobs run after user deletion; automation reusing ids from another instance; LDAP ids differing from visible names.

Related errors


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