{"record":{"id":"289483f0bd4695ee","repo":"nextcloud/server","slug":"user-user-has-no-calendar-subscription-with-the-u","errorCode":null,"errorMessage":"User $user has no calendar subscription with the URI $uri","messagePattern":"User \\$user has no calendar subscription with the URI \\$uri","errorType":"console","errorClass":"InvalidArgumentException","httpStatus":null,"severity":"error","filePath":"apps/dav/lib/Command/DeleteSubscription.php","lineNumber":67,"sourceCode":"\t#[\\Override]\n\tprotected function execute(InputInterface $input, OutputInterface $output): int {\n\t\t$user = (string)$input->getArgument('uid');\n\t\tif (!$this->userManager->userExists($user)) {\n\t\t\tthrow new \\InvalidArgumentException(\"User $user is unknown\");\n\t\t}\n\n\t\t$uri = (string)$input->getArgument('uri');\n\t\tif ($uri === '') {\n\t\t\tthrow new \\InvalidArgumentException('Specify the URI of the calendar to be deleted');\n\t\t}\n\n\t\t$subscriptionInfo = $this->calDavBackend->getSubscriptionByUri(\n\t\t\t'principals/users/' . $user,\n\t\t\t$uri\n\t\t);\n\n\t\tif ($subscriptionInfo === null) {\n\t\t\tthrow new \\InvalidArgumentException(\"User $user has no calendar subscription with the URI $uri\");\n\t\t}\n\n\t\t$subscription = new CachedSubscription(\n\t\t\t$this->calDavBackend,\n\t\t\t$subscriptionInfo,\n\t\t);\n\n\t\t$subscription->delete();\n\n\t\t$output->writeln(\"Calendar subscription with the URI $uri for user $user deleted\");\n\n\t\treturn self::SUCCESS;\n\t}\n}\n","sourceCodeStart":49,"sourceCodeEnd":82,"githubUrl":"https://github.com/nextcloud/server/blob/ecdeb153ffdf227235c9a7e2d13dbe0f9c817bc3/apps/dav/lib/Command/DeleteSubscription.php#L49-L82","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"# before\nocc dav:delete-subscription alice personal\n# InvalidArgumentException: User alice has no calendar subscription with the URI personal\n\n# after\nocc dav:list-subscriptions alice\n# URI:                # DISPLAYNAME: ...\n# personal-friends    Friends calendar\nocc dav:delete-subscription alice personal-friends","handlingStrategy":"validation","validationCode":"#!/usr/bin/env bash\n# confirm the subscription exists before deleting\nuid=\"$1\"; uri=\"$2\"\nif ! occ dav:list-subscriptions \"$uid\" | awk 'NR>1 {print $1}' | grep -Fxq \"$uri\"; then\n  echo \"No subscription '$uri' for $uid — aborting\" >&2\n  exit 1\nfi\nocc dav:delete-subscription \"$uid\" \"$uri\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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"],"tags":["dav","calendar","subscription","occ","cli"],"backgroundTag":"resource-not-found","analyzedSha":"ecdeb153ffdf227235c9a7e2d13dbe0f9c817bc3","analyzedAt":"2026-08-17T01:36:13.386Z","schemaVersion":2},"datasetVersion":"2026-08-17T04:17:16.089Z"}