{"record":{"id":"e129df470c160018","repo":"nextcloud/server","slug":"specify-the-uri-of-the-calendar-to-be-deleted","errorCode":null,"errorMessage":"Specify the URI of the calendar to be deleted","messagePattern":"Specify the URI of the calendar to be deleted","errorType":"console","errorClass":"InvalidArgumentException","httpStatus":null,"severity":"error","filePath":"apps/dav/lib/Command/DeleteSubscription.php","lineNumber":58,"sourceCode":"\t\t\t\t'User who owns the calendar subscription'\n\t\t\t)\n\t\t\t->addArgument(\n\t\t\t\t'uri',\n\t\t\t\tInputArgument::REQUIRED,\n\t\t\t\t'URI of the calendar to be deleted'\n\t\t\t);\n\t}\n\n\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","sourceCodeStart":40,"sourceCodeEnd":76,"githubUrl":"https://github.com/nextcloud/server/blob/ecdeb153ffdf227235c9a7e2d13dbe0f9c817bc3/apps/dav/lib/Command/DeleteSubscription.php#L40-L76","documentation":"InvalidArgumentException from occ dav:delete-subscription when the uri argument is present but empty after casting to string. Although declared REQUIRED, Symfony console accepts an empty string for required arguments in some invocation styles, so the command guards explicitly and refuses to query with an empty URI.","triggerScenarios":"occ dav:delete-subscription <uid> '' or a wrapper forwarding an unset/empty URI variable; JSON/CSV-driven scripts where the uri column is blank for a row.","commonSituations":"Shell wrappers passing \"$uri\" when uri is unset; CSV rows with missing values; nested quoting that collapses the argument to an empty string.","solutions":["Pass the exact subscription URI: list them first with occ dav:list-subscriptions <uid>","Validate that the uri variable is non-empty before invoking the command in scripts","Skip rows with blank URIs in batch imports and report them separately"],"exampleFix":"# before: empty uri argument\nocc dav:delete-subscription jdoe ''\n# after: list subscriptions, then pass the exact URI\nocc dav:list-subscriptions jdoe\nocc dav:delete-subscription jdoe company-holidays","handlingStrategy":"validation","validationCode":"#!/bin/bash\nuid=\"$1\"; uri=\"$2\"\nif [ -z \"$uri\" ]; then\n  occ dav:list-subscriptions \"$uid\"  # show valid URIs\n  echo 'pass a subscription URI' >&2; exit 1\nfi\nocc dav:delete-subscription \"$uid\" \"$uri\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Reject empty/blank URI fields in CSV- or JSON-driven scripts","Enumerate with occ dav:list-subscriptions and match URIs exactly"],"tags":["occ","cli","caldav","missing-argument","subscription"],"backgroundTag":"missing-required-argument","analyzedSha":"ecdeb153ffdf227235c9a7e2d13dbe0f9c817bc3","analyzedAt":"2026-08-17T01:36:13.386Z","schemaVersion":2},"datasetVersion":"2026-08-17T04:17:16.089Z"}