{"record":{"id":"8da1560f38c16db3","repo":"nextcloud/server","slug":"user-user-is-unknown","errorCode":null,"errorMessage":"User $user is unknown","messagePattern":"User \\$user is unknown","errorType":"console","errorClass":"InvalidArgumentException","httpStatus":null,"severity":"error","filePath":"apps/dav/lib/Command/ClearCalendarUnshares.php","lineNumber":60,"sourceCode":"\t\tprivate SharingMapper $mapper,\n\t) {\n\t\tparent::__construct();\n\t}\n\n\t#[\\Override]\n\tprotected function configure(): void {\n\t\t$this->addArgument(\n\t\t\t'uid',\n\t\t\tInputArgument::REQUIRED,\n\t\t\t'User whose unshares to clear'\n\t\t);\n\t}\n\n\t#[\\Override]\n\tprotected function execute(InputInterface $input, OutputInterface $output): int {\n\t\t$user = (string)$input->getArgument('uid');\n\t\tif (!$this->userManager->userExists($user)) {\n\t\t\tthrow new \\InvalidArgumentException(\"User $user is unknown\");\n\t\t}\n\n\t\t$principal = $this->principal->getPrincipalByPath('principals/users/' . $user);\n\t\tif ($principal === null) {\n\t\t\tthrow new \\InvalidArgumentException(\"Unable to fetch principal for user $user \");\n\t\t}\n\n\t\t$shares = $this->mapper->getSharesByPrincipals([$principal['uri']], 'calendar');\n\t\t$unshares = array_filter($shares, static fn ($share) => $share['access'] === BackendAlias::ACCESS_UNSHARED);\n\n\t\tif (count($unshares) === 0) {\n\t\t\t$output->writeln(\"User $user has no calendar unshares\");\n\t\t\treturn self::SUCCESS;\n\t\t}\n\n\t\t$rows = array_map(fn ($share) => $this->formatCalendarUnshare($share), $shares);\n\n\t\t$table = new Table($output);","sourceCodeStart":42,"sourceCodeEnd":78,"githubUrl":"https://github.com/nextcloud/server/blob/ecdeb153ffdf227235c9a7e2d13dbe0f9c817bc3/apps/dav/lib/Command/ClearCalendarUnshares.php#L42-L78","documentation":"InvalidArgumentException from the occ dav:clear-calendar-unshares command when the required uid argument does not match an existing user (userManager->userExists() returns false). The command aborts before touching the calendar share database.","triggerScenarios":"Running occ dav:clear-calendar-unshares <uid> where uid is misspelled, is an email address instead of the user id, contains wrong case, or refers to a deleted user.","commonSituations":"Automation scripts passing the mail address where the backend user id is expected; LDAP-provisioned users whose id differs from the visible name; copy-paste of uids from a different environment.","solutions":["List valid ids with occ user:list and re-run with the exact id","Verify a single user with occ user:info <uid> first","In automation, resolve the uid from your directory/LDAP source before invoking the command"],"exampleFix":"# before\nocc dav:clear-calendar-unshares jdoe@example.com\n# after: use the exact user id (see occ user:list)\nocc user:list\nocc dav:clear-calendar-unshares jdoe","handlingStrategy":"validation","validationCode":"#!/bin/bash\nuid=\"$1\"\nif ! occ user:info \"$uid\" >/dev/null 2>&1; then\n  echo \"unknown user: $uid\" >&2; exit 1\nfi\nocc dav:clear-calendar-unshares \"$uid\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Resolve uids from occ user:list / your directory before invoking","Remember the uid is a backend id, not an email address","Quote arguments in scripts"],"tags":["occ","cli","dav","user-not-found","sharing"],"backgroundTag":"user-not-found","analyzedSha":"ecdeb153ffdf227235c9a7e2d13dbe0f9c817bc3","analyzedAt":"2026-08-17T01:36:13.386Z","schemaVersion":2},"datasetVersion":"2026-08-17T04:17:16.089Z"}