{"record":{"id":"c8a091b1d5d8aa45","repo":"nextcloud/server","slug":"user-user-is-unknown-c8a091","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/ListAddressbooks.php","lineNumber":41,"sourceCode":"\t\tprivate CardDavBackend $cardDavBackend,\n\t) {\n\t\tparent::__construct('dav:list-addressbooks');\n\t}\n\n\t#[\\Override]\n\tprotected function configure(): void {\n\t\t$this\n\t\t\t->setDescription('List all addressbooks of a user')\n\t\t\t->addArgument('uid',\n\t\t\t\tInputArgument::REQUIRED,\n\t\t\t\t'User for whom all addressbooks will be listed');\n\t}\n\n\t#[\\Override]\n\tprotected function execute(InputInterface $input, OutputInterface $output): int {\n\t\t$user = $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$addressBooks = $this->cardDavBackend->getAddressBooksForUser(\"principals/users/$user\");\n\n\t\t$addressBookTableData = [];\n\t\tforeach ($addressBooks as $book) {\n\t\t\t// skip system / contacts integration address book\n\t\t\tif ($book['uri'] === SystemAddressbook::URI_SHARED) {\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t$readOnly = false;\n\t\t\t$readOnlyIndex = '{' . \\OCA\\DAV\\DAV\\Sharing\\Plugin::NS_OWNCLOUD . '}read-only';\n\t\t\tif (isset($book[$readOnlyIndex])) {\n\t\t\t\t$readOnly = $book[$readOnlyIndex];\n\t\t\t}\n\n\t\t\t$addressBookTableData[] = [","sourceCodeStart":23,"sourceCodeEnd":59,"githubUrl":"https://github.com/nextcloud/server/blob/ecdeb153ffdf227235c9a7e2d13dbe0f9c817bc3/apps/dav/lib/Command/ListAddressbooks.php#L23-L59","documentation":"Thrown by occ dav:list-addressbooks when the required uid argument does not correspond to an existing user (IUserManager::userExists() returns false). The check runs before CardDavBackend::getAddressBooksForUser() is called, so it is a pure input-validation failure with no side effects. The angle brackets in the message are literal formatting around the interpolated user id.","triggerScenarios":"`occ dav:list-addressbooks <uid>` with a typo'd, deleted, or not-yet-provisioned user id; empty string passed via scripting; user exists only in an external backend that is currently unavailable (LDAP server down) so userExists() returns false.","commonSituations":"Script iterates over a stale user list; user was renamed or deleted between listing and command run; LDAP/external user backend offline or not provisioned; CI runs against a fresh instance without seeded users.","solutions":["Confirm the exact id with `occ user:list` (or `occ user:info <uid>`)","If the user comes from LDAP, check the backend connection and run the LDAP sync","Fix the calling script to validate ids against `occ user:list` before invoking the command"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"#!/usr/bin/env bash\nuid=\"$1\"\nocc user:info \"$uid\" >/dev/null 2>&1 || { echo \"Unknown user: $uid\" >&2; exit 1; }\nocc dav:list-addressbooks \"$uid\"","typeGuard":"function isValidUid(string $uid): bool {\n    return \\OC::$server->getUserManager()->userExists($uid);\n}","tryCatchPattern":null,"preventionTips":["Validate uids against `occ user:list` in automation before invoking dav commands","For external backends, verify backend availability before batch runs","Quote uids to avoid shell mangling of special characters"],"tags":["dav","addressbook","occ","cli","user-validation"],"backgroundTag":"unknown-user-id","analyzedSha":"ecdeb153ffdf227235c9a7e2d13dbe0f9c817bc3","analyzedAt":"2026-08-17T01:36:13.386Z","schemaVersion":2},"datasetVersion":"2026-08-17T04:17:16.089Z"}