{"record":{"id":"554deb92b43b857e","repo":"nextcloud/server","slug":"user-userid-not-found","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/ExportCalendar.php","lineNumber":61,"sourceCode":"\t#[\\Override]\n\tprotected function configure(): void {\n\t\t$this->setName('calendar:export')\n\t\t\t->setDescription('Export calendar data from supported calendars to disk or stdout')\n\t\t\t->addArgument('uid', InputArgument::REQUIRED, 'Id of system user')\n\t\t\t->addArgument('uri', InputArgument::REQUIRED, 'URI of calendar')\n\t\t\t->addOption('format', null, InputOption::VALUE_REQUIRED, 'Format of output (ical, jcal, xcal) defaults to ical', 'ical')\n\t\t\t->addOption('location', null, InputOption::VALUE_REQUIRED, 'Location of where to write the output. Defaults to stdout');\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$format = $input->getOption('format');\n\t\t$location = $input->getOption('location');\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 export is supported\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 ICalendarExport) {\n\t\t\tthrow new InvalidArgumentException(\"Calendar <$calendarId> does not support exporting\");\n\t\t}\n\t\t// construct options object\n\t\t$options = new CalendarExportOptions();\n\t\t// evaluate if provided format is supported\n\t\tif (!in_array($format, ExportService::FORMATS, true)) {\n\t\t\tthrow new InvalidArgumentException(\"Format <$format> is not valid.\");\n\t\t}\n\t\t$options->setFormat($format);\n\t\t// evaluate if a valid location was given and is usable otherwise output to stdout","sourceCodeStart":43,"sourceCodeEnd":79,"githubUrl":"https://github.com/nextcloud/server/blob/ecdeb153ffdf227235c9a7e2d13dbe0f9c817bc3/apps/dav/lib/Command/ExportCalendar.php#L43-L79","documentation":"Symfony\\Component\\Console\\Exception\\InvalidArgumentException thrown by the occ dav:export-calendar command (apps/dav/lib/Command/ExportCalendar.php:61) when the user id passed as first argument does not exist in the user backend. The command refuses to continue before touching the calendar manager.","triggerScenarios":"occ dav:export-calendar <uid> <calendar-uri> [--format=ical|jcal|xcal] [--location=...] where <uid> is not returned by IUserManager::userExists() - typo'd id, deleted user, or wrong user backend (e.g. user only exists in LDAP but LDAP is unreachable).","commonSituations":"Typo in the uid; running the command before provisioning the user; LDAP/external user backend temporarily unavailable so userExists() fails; copy-pasting examples that contain placeholder names.","solutions":["List valid ids with occ user:list and re-run with the exact uid","If the user should come from LDAP/external backend, verify that backend is configured and reachable (occ user:lastseen, occ ldap:test-config)","Re-run the command with a uid that userExists() confirms"],"exampleFix":"# before\nocc dav:export-calendar alic example-personal\n# after\nocc user:list | grep -i alic   # find exact id, e.g. 'alice'\nocc dav:export-calendar alice personal","handlingStrategy":"validation","validationCode":"// programmatic callers: verify the uid first\nif (!$userManager->userExists($uid)) {\n    throw new RuntimeException(\"Unknown user $uid - run occ user:list\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    $commandTester->execute(['uid' => $uid, 'uri' => $uri]);\n} catch (\\Symfony\\Component\\Console\\Exception\\InvalidArgumentException $e) {\n    // message contains the offending argument; fix inputs and re-run\n}","preventionTips":["Pipe candidate uids through occ user:list in automation scripts","Validate arguments before invoking occ commands","Resolve users before batch exports"],"tags":["occ","cli","export","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"}