nextcloud/server · error · InvalidArgumentException

User <$user> in unknown.

Error message

User <$user> in unknown.

What it means

InvalidArgumentException from the occ dav:create-address-book command when the required user argument does not exist (userExists() returns false). The command refuses to create the address book for a nonexistent principal.

Source

Thrown at apps/dav/lib/Command/CreateAddressBook.php:43

	#[\Override]
	protected function configure(): void {
		$this
			->setName('dav:create-addressbook')
			->setDescription('Create a dav addressbook')
			->addArgument('user',
				InputArgument::REQUIRED,
				'User for whom the addressbook will be created')
			->addArgument('name',
				InputArgument::REQUIRED,
				'Name of the addressbook');
	}

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

		$name = $input->getArgument('name');
		$this->cardDavBackend->createAddressBook("principals/users/$user", $name, []);
		return self::SUCCESS;
	}
}

View on GitHub (pinned to ecdeb153ff)

Solutions

  1. Get the exact id from occ user:list and re-run
  2. Validate with occ user:info <uid> in scripts before creating resources
  3. Quote arguments to avoid shell splitting of ids containing dots

Example fix

# before
occ dav:create-address-book john.doe@example.com 'Customers'
# after: user id, not email
occ user:list
occ dav:create-address-book john 'Customers'
Defensive patterns

Strategy: validation

Validate before calling

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

Prevention

When it happens

Trigger: occ dav:create-address-book <user> <name> where user is misspelled, is an email instead of the backend user id, or was deleted.

Common situations: Provisioning scripts using email addresses as user ids; case-sensitive ids copied from another environment; LDAP ids that differ from display names.

Related errors


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