{"record":{"id":"3be884de14d17f9a","repo":"nextcloud/server","slug":"user-userorigin-has-no-calendar-named-name","errorCode":null,"errorMessage":"User <$userOrigin> has no calendar named <$name>. You can run occ dav:list-calendars to list calendars URIs for this user.","messagePattern":"User <\\$userOrigin> 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/MoveCalendar.php","lineNumber":80,"sourceCode":"\t\t$userDestination = $input->getArgument('destinationuid');\n\n\t\t$this->io = new SymfonyStyle($input, $output);\n\n\t\tif (!$this->userManager->userExists($userOrigin)) {\n\t\t\tthrow new \\InvalidArgumentException(\"User <$userOrigin> is unknown.\");\n\t\t}\n\n\t\tif (!$this->userManager->userExists($userDestination)) {\n\t\t\tthrow new \\InvalidArgumentException(\"User <$userDestination> is unknown.\");\n\t\t}\n\n\t\t$name = $input->getArgument('name');\n\t\t$newName = null;\n\n\t\t$calendar = $this->calDav->getCalendarByUri(self::URI_USERS . $userOrigin, $name);\n\n\t\tif ($calendar === null) {\n\t\t\tthrow new \\InvalidArgumentException(\"User <$userOrigin> 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 already exists\n\t\tif ($this->calendarExists($userDestination, $name)) {\n\t\t\tif ($input->getOption('force')) {\n\t\t\t\t// Try to find a suitable name\n\t\t\t\t$newName = $this->getNewCalendarName($userDestination, $name);\n\n\t\t\t\t// If we didn't find a suitable value after all the iterations, give up\n\t\t\t\tif ($this->calendarExists($userDestination, $newName)) {\n\t\t\t\t\tthrow new \\InvalidArgumentException(\"Unable to find a suitable calendar name for <$userDestination> with initial name <$name>.\");\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tthrow new \\InvalidArgumentException(\"User <$userDestination> already has a calendar named <$name>.\");\n\t\t\t}\n\t\t}\n\n\t\t$hadShares = $this->checkShares($calendar, $userOrigin, $userDestination, $input->getOption('force'));","sourceCodeStart":62,"sourceCodeEnd":98,"githubUrl":"https://github.com/nextcloud/server/blob/ecdeb153ffdf227235c9a7e2d13dbe0f9c817bc3/apps/dav/lib/Command/MoveCalendar.php#L62-L98","documentation":"Thrown by occ dav:move-calendar when CalDavBackend::getCalendarByUri('principals/users/<sourceuid>', $name) returns null: the source user has no calendar with that URI. The name argument must be the calendar URI (the dav:list-calendars output), not the display name. Nothing is moved.","triggerScenarios":"`occ dav:move-calendar <src> <dst> <name>` where name is the display name instead of the URI, has a typo, or the calendar belongs to a different user. Birthday calendars and subscriptions are not returned by getCalendarByUri for this path either.","commonSituations":"Admin copies 'Work' (display name) while the URI is 'work-1'; calendar already moved in a previous run; trailing whitespace or URL-encoded characters in the URI.","solutions":["Run `occ dav:list-calendars <sourceuid>` and use the exact URI column value","Quote the name in the shell to avoid globbing/whitespace issues","If the calendar is a subscription, note that move-calendar handles calendars only — move it via create/delete subscription"],"exampleFix":"# before\nocc dav:move-calendar alice bob Work\n# User <alice> has no calendar named <Work>. You can run occ dav:list-calendars ...\n\n# after\nocc dav:list-calendars alice\n# URI: ...\n# work-1\nocc dav:move-calendar alice bob work-1","handlingStrategy":"validation","validationCode":"#!/usr/bin/env bash\nsrc=\"$1\"; dst=\"$2\"; name=\"$3\"\nif ! occ dav:list-calendars \"$src\" | awk 'NR>1 {print $1}' | grep -Fxq \"$name\"; then\n  echo \"Calendar '$name' not found for $src\" >&2; exit 1\nfi\nocc dav:move-calendar \"$src\" \"$dst\" \"$name\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always use the URI column of dav:list-calendars, not the display name","Quote calendar names; strip whitespace when copying from other tools","Remember move-calendar covers calendars, not subscriptions or birthday calendars"],"tags":["dav","calendar","migration","occ","cli","resource-validation"],"backgroundTag":"resource-not-found","analyzedSha":"ecdeb153ffdf227235c9a7e2d13dbe0f9c817bc3","analyzedAt":"2026-08-17T01:36:13.386Z","schemaVersion":2},"datasetVersion":"2026-08-17T04:17:16.089Z"}