nextcloud/server · error · InvalidArgumentException
User $user is unknown
Error message
User $user is unknown
What it means
Thrown by occ dav:list-calendar-shares when the required uid argument fails IUserManager::userExists(). It is the first of two guards in execute(): the user check precedes the principal lookup, so hitting it means the user backend itself does not know the id. No share data is read.
Source
Thrown at apps/dav/lib/Command/ListCalendarShares.php:60
$this->addArgument(
'uid',
InputArgument::REQUIRED,
'User whose calendar shares will be listed'
);
$this->addOption(
'calendar-id',
'',
InputOption::VALUE_REQUIRED,
'List only shares for the given calendar id id',
null,
);
}
#[\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");
}
$principal = $this->principal->getPrincipalByPath('principals/users/' . $user);
if ($principal === null) {
throw new \InvalidArgumentException("Unable to fetch principal for user $user");
}
$memberships = array_merge(
[$principal['uri']],
$this->principal->getGroupMembership($principal['uri']),
$this->principal->getCircleMembership($principal['uri']),
);
$shares = $this->mapper->getSharesByPrincipals($memberships, 'calendar');
$calendarId = $input->getOption('calendar-id');
if ($calendarId !== null) {
$shares = array_filter($shares, fn ($share) => $share['resourceid'] === (int)$calendarId);View on GitHub (pinned to ecdeb153ff)
Solutions
- Verify the id with `occ user:info <uid>` / `occ user:list`
- Check external user backends (LDAP connection, `occ user:sync`) if the user should exist
- Re-run with the corrected uid
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-calendar-shares "$uid" Prevention
- Re-validate user ids immediately before running, not from cached lists
- Automate against the same environment the ids came from
- Handle external-backend outages as a distinct failure from typos
When it happens
Trigger: `occ dav:list-calendar-shares <uid>` with a non-existent, deleted, or externally-provisioned-but-unavailable user id.
Common situations: Typo in uid; user removed after the admin copied the id; LDAP backend unreachable so the user resolves as absent; automation running against the wrong instance.
Related errors
- User <$user> is unknown.
- User $user is unknown
- User <$userOrigin> is unknown.
- User <$userDestination> is unknown.
- User <$userDestination> is not part of the group <$userOrGro
AI-assisted analysis of nextcloud/server@ecdeb153ff (2026-08-17).
Data as JSON: /api/errors/59272e18fa65f254.
Report an issue: GitHub.