{"record":{"id":"ae718c4cffcf6f4c","repo":"passbolt/passbolt_api","slug":"the-user-identifier-should-be-a-valid-uuid","errorCode":null,"errorMessage":"The user identifier should be a valid UUID.","messagePattern":"The user identifier should be a valid UUID\\.","errorType":"validation","errorClass":"BadRequestException","httpStatus":400,"severity":"error","filePath":"plugins/PassboltCe/AccountSettings/src/Model/Table/AccountSettingsTable.php","lineNumber":150,"sourceCode":"     */\n    public function buildRules(RulesChecker $rules): RulesChecker\n    {\n        $rules->add($rules->existsIn(['user_id'], 'Users'));\n\n        return $rules;\n    }\n\n    /**\n     * Find all the settings for a given user\n     *\n     * @param string $userId uuid\n     * @param array $whitelist example ['theme']\n     * @return \\Cake\\ORM\\Query\\SelectQuery\n     */\n    public function findIndex(string $userId, array $whitelist): SelectQuery\n    {\n        if (!Validation::uuid($userId)) {\n            throw new BadRequestException(__('The user identifier should be a valid UUID.'));\n        }\n\n        $props = [];\n        foreach ($whitelist as $item) {\n            $props[] = $this->propertyToPropertyId($item);\n        }\n\n        return $this->find()->where(['user_id' => $userId, 'property_id IN' => $props]);\n    }\n\n    /**\n     * Find all the settings for a given user\n     *\n     * @param string $userId uuid\n     * @param string $property The name of the property to get\n     * @return \\Passbolt\\AccountSettings\\Model\\Entity\\AccountSetting The first result from the ResultSet.\n     * @throws \\Cake\\Datasource\\Exception\\RecordNotFoundException When there is no first record.\n     * @throws \\Cake\\Http\\Exception\\BadRequestException When the user ID is not valid.","sourceCodeStart":132,"sourceCodeEnd":168,"githubUrl":"https://github.com/passbolt/passbolt_api/blob/31c1bbc10f32808a607fa9bd81891e898779c0bc/plugins/PassboltCe/AccountSettings/src/Model/Table/AccountSettingsTable.php#L132-L168","documentation":"Thrown by Gnupg::importKeyIntoKeyring when gnupg_import() raises an exception; the gnupg error text is appended. It means GnuPG could not accept the armored key material into its keyring at all (malformed key, keyring problem, or gnupg extension error).","triggerScenarios":"Calling importKeyIntoKeyring with corrupted/unparseable key data, or when the gnupg extension/keyring fails during import (e.g. GNUPGHOME not writable).","commonSituations":"GNUPGHOME directory not writable by the web server user; corrupted key from a bad copy/paste; gnupg module misconfiguration; keys larger than allowed limits.","solutions":["Check the appended gnupg exception message for the specific gnupg error.","Verify GNUPGHOME exists and is writable by the PHP user (pubring.gpg ownership).","Validate the armored key with `gpg --show-keys` outside the app.","Re-export the key in ASCII armor and retry.","Test that the gnupg PHP extension works: `var_dump(gnupg_keylistiterator...)` or a minimal gnupg::import."],"exampleFix":"// before\nexec('gpg --import', $out); // manual shell import bypassing error handling\n// after\n$fingerprint = $gpg->importKeyIntoKeyring($armoredKey); // and check GNUPGHOME perms if it throws","handlingStrategy":"try-catch","validationCode":"$gpg->getPublicKeyInfo($armoredKey); // throws early if the key is not parsable\n","typeGuard":"function isArmoredKey(string $s): bool {\n    return is_string($s)\n        && preg_match('/-----BEGIN PGP (PUBLIC|PRIVATE) KEY BLOCK-----/', $s) === 1;\n}\n","tryCatchPattern":"try {\n    $fp = $gpg->importKeyIntoKeyring($armoredKey);\n} catch (\\Cake\\Core\\Exception\\Exception $e) {\n    $this->log('gnupg import failed: ' . $e->getMessage());\n    throw new KeyImportException(previous: $e);\n}\n","preventionTips":["Ensure GNUPGHOME exists and is writable by the PHP user before the first import.","Validate keys with the gpg CLI (`gpg --show-keys`) when debugging.","Keep the pecl gnupg extension and gpg binary versions compatible.","Import keys once at process start and reuse, rather than repeatedly."],"tags":["openpgp","gnupg","key-import","keyring"],"backgroundTag":"api-request-failed","analyzedSha":"31c1bbc10f32808a607fa9bd81891e898779c0bc","analyzedAt":"2026-09-17T00:04:38.960Z","contentChangedAt":"2026-09-17T00:04:38.960Z","schemaVersion":2},"datasetVersion":"2026-09-21T04:17:39.646Z"}