{"record":{"id":"8a5fb1195a54c1d1","repo":"nextcloud/server","slug":"calendar-calendarid-not-found-8a5fb1","errorCode":null,"errorMessage":"Calendar <$calendarId> not found","messagePattern":"Calendar <\\$calendarId> not found","errorType":"console","errorClass":"InvalidArgumentException","httpStatus":null,"severity":"error","filePath":"apps/dav/lib/Command/ImportCalendar.php","lineNumber":85,"sourceCode":"\t\t$userId = $input->getArgument('uid');\n\t\t$calendarId = $input->getArgument('uri');\n\t\t$location = $input->getArgument('location');\n\t\t$format = $input->getOption('format');\n\t\t$errors = is_numeric($input->getOption('errors')) ? (int)$input->getOption('errors') : null;\n\t\t$validation = is_numeric($input->getOption('validation')) ? (int)$input->getOption('validation') : null;\n\t\t$supersede = $input->getOption('supersede');\n\t\t$showCreated = $input->getOption('show-created');\n\t\t$showUpdated = $input->getOption('show-updated');\n\t\t$showSkipped = $input->getOption('show-skipped');\n\t\t$showErrors = $input->getOption('show-errors');\n\n\t\tif (!$this->userManager->userExists($userId)) {\n\t\t\tthrow new InvalidArgumentException(\"User <$userId> not found.\");\n\t\t}\n\t\t// retrieve calendar and evaluate if import is supported and writeable\n\t\t$calendars = $this->calendarManager->getCalendarsForPrincipal('principals/users/' . $userId, [$calendarId]);\n\t\tif ($calendars === []) {\n\t\t\tthrow new InvalidArgumentException(\"Calendar <$calendarId> not found\");\n\t\t}\n\t\t$calendar = $calendars[0];\n\t\tif (!$calendar instanceof CalendarImpl) {\n\t\t\tthrow new InvalidArgumentException(\"Calendar <$calendarId> doesn't support this function\");\n\t\t}\n\t\tif (!$calendar->isWritable()) {\n\t\t\tthrow new InvalidArgumentException(\"Calendar <$calendarId> is not writeable\");\n\t\t}\n\t\tif ($calendar->isDeleted()) {\n\t\t\tthrow new InvalidArgumentException(\"Calendar <$calendarId> is deleted\");\n\t\t}\n\t\t// construct options object\n\t\t$options = new CalendarImportOptions();\n\t\t$options->setSupersede($supersede);\n\t\tif ($errors !== null) {\n\t\t\t$options->setErrors($errors);\n\t\t}\n\t\tif ($validation !== null) {","sourceCodeStart":67,"sourceCodeEnd":103,"githubUrl":"https://github.com/nextcloud/server/blob/ecdeb153ffdf227235c9a7e2d13dbe0f9c817bc3/apps/dav/lib/Command/ImportCalendar.php#L67-L103","documentation":"InvalidArgumentException thrown by occ dav:import-calendar (apps/dav/lib/Command/ImportCalendar.php:85) when getCalendarsForPrincipal('principals/users/<uid>', [<uri>]) returns no calendar - the import target URI does not exist for that principal.","triggerScenarios":"occ dav:import-calendar alice <uri> calendar.ics where <uri> is not a calendar of alice (typo, wrong case, other principal, or app calendar registered under a different id).","commonSituations":"Using display names instead of URIs; importing into a calendar that was deleted or belongs to a shared/delegated principal; case mismatches.","solutions":["PROPFIND /remote.php/dav/calendars/alice/ (or query oc_calendars.uri) to get the exact URI","Create the target first with a CalDAV client or use an existing calendar URI","Re-run with the case-sensitive URI"],"exampleFix":"# before\nocc dav:import-calendar alice Personal calendar.ics\n# after  (uri is lowercase 'personal')\nocc dav:import-calendar alice personal calendar.ics","handlingStrategy":"validation","validationCode":"$uris = array_map(fn ($c) => $c->getUri(),\n    $calendarManager->getCalendarsForPrincipal('principals/users/' . $uid));\nin_array($uri, $uris, true) || throw new RuntimeException('Unknown calendar uri');","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Discover URIs with PROPFIND on /remote.php/dav/calendars/<uid>/","Calendar URIs are case-sensitive","Import targets must belong to the same principal"],"tags":["occ","cli","import","calendar","caldav","not-found","invalid-argument"],"backgroundTag":"resource-not-found","analyzedSha":"ecdeb153ffdf227235c9a7e2d13dbe0f9c817bc3","analyzedAt":"2026-08-17T01:36:13.386Z","schemaVersion":2},"datasetVersion":"2026-08-17T04:17:16.089Z"}