{"record":{"id":"576dbc3cbdbf6130","repo":"nextcloud/server","slug":"user-user-has-no-calendar-named-name-you-ca","errorCode":null,"errorMessage":"User <$user> has no calendar named <$name>. You can run occ dav:list-calendars to list calendars URIs for this user.","messagePattern":"User <\\$user> has no calendar named <\\$name>\\. You can run occ dav:list-calendars to list calendars URIs for this user\\.","errorType":"console","errorClass":"InvalidArgumentException","httpStatus":null,"severity":"error","filePath":"apps/dav/lib/Command/DeleteCalendar.php","lineNumber":84,"sourceCode":"\t\t}\n\n\t\t$birthday = $input->getOption('birthday');\n\t\tif ($birthday !== false) {\n\t\t\t$name = BirthdayService::BIRTHDAY_CALENDAR_URI;\n\t\t} else {\n\t\t\t/** @var string $name */\n\t\t\t$name = $input->getArgument('name');\n\t\t\tif (!$name) {\n\t\t\t\tthrow new \\InvalidArgumentException(\n\t\t\t\t\t'Please specify a calendar name or --birthday');\n\t\t\t}\n\t\t}\n\n\t\t$calendarInfo = $this->calDav->getCalendarByUri(\n\t\t\t'principals/users/' . $user,\n\t\t\t$name);\n\t\tif ($calendarInfo === null) {\n\t\t\tthrow new \\InvalidArgumentException(\n\t\t\t\t'User <' . $user . '> has no calendar named <' . $name . '>. You can run occ dav:list-calendars to list calendars URIs for this user.');\n\t\t}\n\n\t\t$calendar = new Calendar(\n\t\t\t$this->calDav,\n\t\t\t$calendarInfo,\n\t\t\t$this->l10n,\n\t\t\t$this->config,\n\t\t\t$this->logger\n\t\t);\n\n\t\t$force = $input->getOption('force');\n\t\tif ($force) {\n\t\t\t$calendar->disableTrashbin();\n\t\t}\n\n\t\t$calendar->delete();\n","sourceCodeStart":66,"sourceCodeEnd":102,"githubUrl":"https://github.com/nextcloud/server/blob/ecdeb153ffdf227235c9a7e2d13dbe0f9c817bc3/apps/dav/lib/Command/DeleteCalendar.php#L66-L102","documentation":"InvalidArgumentException from occ dav:delete-calendar when getCalendarByUri('principals/users/<uid>', <name>) returns null — the user has no calendar with that URI. The name argument is matched against the calendar URI, not the display name, which is the most common cause of the mismatch.","triggerScenarios":"occ dav:delete-calendar <uid> <name> where name is the human-readable display name (e.g. 'My Personal Calendar') instead of the URI (e.g. 'personal'), or the calendar belongs to a different user / was already deleted.","commonSituations":"Operators copying the label shown in the calendar UI; URIs changed after a rename; scripts using display names from an export; birthday calendar targeted without --birthday.","solutions":["List the user's calendar URIs with occ dav:list-calendars <uid> and pass the exact uri","If you meant the auto-generated birthday calendar, use --birthday instead of guessing its URI","Confirm the target user is the calendar's owner"],"exampleFix":"# before: display name used as URI\nocc dav:delete-calendar jdoe 'My Personal Calendar'\n# after: look up the URI first, then delete by it\nocc dav:list-calendars jdoe   # e.g. shows uri 'personal'\nocc dav:delete-calendar jdoe personal","handlingStrategy":"validation","validationCode":"#!/bin/bash\nuid=\"$1\"; uri=\"$2\"\n# resolve URIs first; the command expects the URI, not the display name\nocc dav:list-calendars \"$uid\"\nocc dav:delete-calendar \"$uid\" \"$uri\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always resolve calendar URIs via occ dav:list-calendars before deleting","Never pass the display name shown in the UI","Use --birthday for the auto-generated birthday calendar"],"tags":["occ","cli","caldav","calendar-not-found"],"backgroundTag":"resource-not-found","analyzedSha":"ecdeb153ffdf227235c9a7e2d13dbe0f9c817bc3","analyzedAt":"2026-08-17T01:36:13.386Z","schemaVersion":2},"datasetVersion":"2026-08-17T04:17:16.089Z"}