nextcloud/server · error · InvalidArgumentException
User <$user> in unknown.
Error message
User <$user> in unknown.
What it means
InvalidArgumentException from the occ dav:create-calendar command when the required user argument does not exist (userExists() returns false). It aborts before constructing the principal backend and creating the calendar.
Source
Thrown at apps/dav/lib/Command/CreateCalendar.php:61
#[\Override]
protected function configure(): void {
$this
->setName('dav:create-calendar')
->setDescription('Create a dav calendar')
->addArgument('user',
InputArgument::REQUIRED,
'User for whom the calendar will be created')
->addArgument('name',
InputArgument::REQUIRED,
'Name of the calendar');
}
#[\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.");
}
$principalBackend = new Principal(
$this->userManager,
$this->groupManager,
Server::get(IAccountManager::class),
Server::get(\OCP\Share\IManager::class),
Server::get(IUserSession::class),
Server::get(IAppManager::class),
Server::get(ProxyMapper::class),
Server::get(KnownUserService::class),
Server::get(IConfig::class),
Server::get(IFactory::class),
);
$random = Server::get(ISecureRandom::class);
$logger = Server::get(LoggerInterface::class);
$dispatcher = Server::get(IEventDispatcher::class);
$config = Server::get(IConfig::class);
$name = $input->getArgument('name');View on GitHub (pinned to ecdeb153ff)
Solutions
- Look up the id with occ user:list and re-run with it
- Pre-check occ user:info <uid> in automation
- Prefer provisioning shares/calendars from your user directory of record rather than free-text input
Example fix
# before occ dav:create-calendar jane.doe@example.com 'Work' # after occ user:list occ dav:create-calendar jane 'Work'
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-calendar "$uid" "$name" Prevention
- Validate the uid against occ user:list in provisioning pipelines
- Pass backend user ids, never email addresses
- Quote arguments containing dots or spaces
When it happens
Trigger: occ dav:create-calendar <user> <name> with a misspelled/deleted user id or an email address passed as the user argument.
Common situations: Automated provisioning with unvalidated user input; environments where LDAP uid differs from mail; scripts reused across instances with different user bases.
Related errors
- User <$userId> not found.
- User <$userId> not found.
- User <$user> in unknown.
- User <$user> is unknown.
- User $user is unknown
AI-assisted analysis of nextcloud/server@ecdeb153ff (2026-08-17).
Data as JSON: /api/errors/62c00fe0fbeba2d9.
Report an issue: GitHub.