nextcloud/server · error · InvalidArgumentException
User $user has no calendar subscription with the URI $uri
Error message
User $user has no calendar subscription with the URI $uri
What it means
Thrown by the occ dav:delete-subscription command when CalDavBackend::getSubscriptionByUri('principals/users/<uid>', $uri) returns null, i.e. no calendar subscription row matches that principal and URI pair. It is an InvalidArgumentException raised before anything is deleted, so the command aborts with no side effects. Subscriptions are cached remote calendars created with dav:create-subscription, distinct from real calendars.
Source
Thrown at apps/dav/lib/Command/DeleteSubscription.php:67
#[\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,
$subscriptionInfo,
);
$subscription->delete();
$output->writeln("Calendar subscription with the URI $uri for user $user deleted");
return self::SUCCESS;
}
}
View on GitHub (pinned to ecdeb153ff)
Solutions
- Run `occ dav:list-subscriptions <uid>` and copy the exact URI from the first column
- Verify the user id exists with `occ user:list` or `occ user:info <uid>`
- If the target is a real calendar rather than a subscription, use `occ dav:delete-calendar <uid> <uri>` instead
- If the subscription is not listed at all, it is already gone and there is nothing to delete
Example fix
# before occ dav:delete-subscription alice personal # InvalidArgumentException: User alice has no calendar subscription with the URI personal # after occ dav:list-subscriptions alice # URI: # DISPLAYNAME: ... # personal-friends Friends calendar occ dav:delete-subscription alice personal-friends
Defensive patterns
Strategy: validation
Validate before calling
#!/usr/bin/env bash
# confirm the subscription exists before deleting
uid="$1"; uri="$2"
if ! occ dav:list-subscriptions "$uid" | awk 'NR>1 {print $1}' | grep -Fxq "$uri"; then
echo "No subscription '$uri' for $uid — aborting" >&2
exit 1
fi
occ dav:delete-subscription "$uid" "$uri" Prevention
- Always derive the URI from `occ dav:list-subscriptions` output, never from the UI display name
- Wrap occ calls in scripts and check exit codes instead of assuming success
- Remember subscriptions and calendars are separate resources with separate commands
When it happens
Trigger: Running `occ dav:delete-subscription <uid> <uri>` where the URI is misspelled, belongs to a different user, was already deleted, or is actually a real calendar URI (not a subscription). The lookup is scoped to principals/users/<uid>, so a URI that exists for another user still yields null.
Common situations: Admin copies the display name from the calendar UI instead of the URI; the subscription was already removed in the UI; wrong user id (typo, deleted account); confusing dav:delete-calendar with dav:delete-subscription.
Related errors
- User $user is unknown
- User $user is unknown
- User <$user> is unknown.
- User <$userOrigin> is unknown.
- User <$userDestination> is unknown.
AI-assisted analysis of nextcloud/server@ecdeb153ff (2026-08-17).
Data as JSON: /api/errors/289483f0bd4695ee.
Report an issue: GitHub.