nextcloud/server · error · InvalidArgumentException
User <$user> is unknown.
Error message
User <$user> is unknown.
What it means
Thrown by occ dav:list-calendars when the required uid argument does not match an existing user (IUserManager::userExists() false). The guard runs before getCalendarsForUser(), so no CalDav queries happen. Note the command explicitly skips the birthday calendar (BirthdayService::BIRTHDAY_CALENDAR_URI) when listing, but that is unrelated to this error.
Source
Thrown at apps/dav/lib/Command/ListCalendars.php:41
) {
parent::__construct();
}
#[\Override]
protected function configure(): void {
$this
->setName('dav:list-calendars')
->setDescription('List all calendars of a user')
->addArgument('uid',
InputArgument::REQUIRED,
'User for whom all calendars will be listed');
}
#[\Override]
protected function execute(InputInterface $input, OutputInterface $output): int {
$user = $input->getArgument('uid');
if (!$this->userManager->userExists($user)) {
throw new \InvalidArgumentException("User <$user> is unknown.");
}
$calendars = $this->caldav->getCalendarsForUser("principals/users/$user");
$calendarTableData = [];
foreach ($calendars as $calendar) {
// skip birthday calendar
if ($calendar['uri'] === BirthdayService::BIRTHDAY_CALENDAR_URI) {
continue;
}
$readOnly = false;
$readOnlyIndex = '{' . \OCA\DAV\DAV\Sharing\Plugin::NS_OWNCLOUD . '}read-only';
if (isset($calendar[$readOnlyIndex])) {
$readOnly = $calendar[$readOnlyIndex];
}
$calendarTableData[] = [View on GitHub (pinned to ecdeb153ff)
Solutions
- Check the exact id via `occ user:list` or `occ user:info <uid>`
- Fix typos / re-run with the correct uid
- If the user should come from LDAP, verify the backend is connected and synced
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-calendars "$uid" Prevention
- Seed CI/test instances with the users your scripts reference
- Derive uid lists dynamically (occ user:list) instead of hardcoding
- Distinguish 'user unknown' from 'user has no calendars' in script error handling
When it happens
Trigger: `occ dav:list-calendars <uid>` with a typo'd or deleted uid, or a user that only exists in an offline external backend.
Common situations: Admin scripts with hardcoded user lists drifting from reality; user deleted between operations; wrong environment (staging vs production); LDAP outage.
Related errors
- User $user is unknown
- User $user is unknown
- User <$userOrigin> is unknown.
- User <$userDestination> is unknown.
- User <$user> in unknown.
AI-assisted analysis of nextcloud/server@ecdeb153ff (2026-08-17).
Data as JSON: /api/errors/1093b66e2e4bdb58.
Report an issue: GitHub.