{"record":{"id":"d89dc4b678112a40","repo":"nextcloud/server","slug":"user-userid-not-found-d89dc4","errorCode":null,"errorMessage":"User <$userId> not found.","messagePattern":"User <\\$userId> not found\\.","errorType":"console","errorClass":"InvalidArgumentException","httpStatus":null,"severity":"error","filePath":"apps/dav/lib/Command/ImportCalendar.php","lineNumber":80,"sourceCode":"\t\t\t->addOption('show-errors', null, InputOption::VALUE_NONE, 'show all errored items after processing');\n\t}\n\n\t#[\\Override]\n\tprotected function execute(InputInterface $input, OutputInterface $output): int {\n\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();","sourceCodeStart":62,"sourceCodeEnd":98,"githubUrl":"https://github.com/nextcloud/server/blob/ecdeb153ffdf227235c9a7e2d13dbe0f9c817bc3/apps/dav/lib/Command/ImportCalendar.php#L62-L98","documentation":"InvalidArgumentException thrown by occ dav:import-calendar (apps/dav/lib/Command/ImportCalendar.php:80) when the first argument uid does not exist in the user backend (IUserManager::userExists() returns false). The command validates the target user before looking up the calendar.","triggerScenarios":"occ dav:import-calendar <uid> <uri> <location> with a non-existent uid: typo, deleted user, or user from an LDAP backend that is currently not resolvable.","commonSituations":"Import scripts replayed after users were removed; provisioning order mistakes (import before user import); LDAP server down during a batch import.","solutions":["occ user:list to confirm the exact uid","Fix/reconnect the user backend if the user should exist, then re-run","Re-run the import with a valid uid"],"exampleFix":"# before\nocc dav:import-calendar alic personal calendar.ics\n# after\nocc dav:import-calendar alice personal calendar.ics","handlingStrategy":"validation","validationCode":"if (!$userManager->userExists($uid)) {\n    throw new RuntimeException(\"Unknown user $uid\");\n}","typeGuard":null,"tryCatchPattern":"try { /* import */ }\ncatch (\\InvalidArgumentException $e) {\n    if (str_contains($e->getMessage(), 'not found')) { /* fix uid, re-run */ }\n}","preventionTips":["Validate uids against occ user:list in import pipelines","Provision users before importing their data","Re-check LDAP availability before batch jobs"],"tags":["occ","cli","import","calendar","caldav","user-not-found","invalid-argument"],"backgroundTag":"user-not-found","analyzedSha":"ecdeb153ffdf227235c9a7e2d13dbe0f9c817bc3","analyzedAt":"2026-08-17T01:36:13.386Z","schemaVersion":2},"datasetVersion":"2026-08-17T04:17:16.089Z"}