{"record":{"id":"07d0dd81f11fddbc","repo":"passbolt/passbolt_api","slug":"record-not-found","errorCode":null,"errorMessage":"Record not found","messagePattern":"Record not found","errorType":"http","errorClass":"NotFoundException","httpStatus":404,"severity":"error","filePath":"plugins/PassboltCe/Rbacs/src/Model/Dto/RbacsUpdateDtoCollection.php","lineNumber":78,"sourceCode":"    public function getIds(): array\n    {\n        return (array)Hash::extract($this->data, '{n}.id');\n    }\n\n    /**\n     * Get an item from the collection using the id\n     *\n     * @param string $id uuid\n     * @return array data {id:<uuid>, control_function:<string>}\n     */\n    public function getById(string $id): array\n    {\n        if (!Validation::uuid($id)) {\n            throw new InvalidArgumentException(__('The identifier should be a valid UUID.') . ' ' . $id);\n        }\n        $result = (array)Hash::extract($this->data, '{n}[id=' . $id . ']');\n        if (!count($result)) {\n            throw new NotFoundException(__('Record not found') . ' ' . $id);\n        }\n\n        return $result[0];\n    }\n\n    /**\n     * @return int\n     */\n    public function count(): int\n    {\n        return count($this->data);\n    }\n\n    /**\n     * Assert the whole data set is correct\n     *\n     * @throw BadRequestException if data is invalid\n     * @param array $data data [{id:<uuid>, control_function:<string>},...]","sourceCodeStart":60,"sourceCodeEnd":96,"githubUrl":"https://github.com/passbolt/passbolt_api/blob/31c1bbc10f32808a607fa9bd81891e898779c0bc/plugins/PassboltCe/Rbacs/src/Model/Dto/RbacsUpdateDtoCollection.php#L60-L96","documentation":"Thrown by RbacsUpdateDtoCollection::getById() when the requested id is a valid UUID but no entry in the collection has that id. It also appends the offending id to the message to help identify the lookup that failed.","triggerScenarios":"Client submits a rbacs update payload containing an id that does not match any existing rbac record being updated; getById() scans the collection and finds no match.","commonSituations":"Stale UI cache submitting ids of rbacs deleted or regenerated since load, ids copy-pasted from another environment, or wrong id (role/rbac mix-up) in the PUT /rbacs/update payload.","solutions":["Refresh the rbacs list (GET /rbacs) and use a current, existing rbac id.","Verify the id belongs to the correct environment/instance.","Ensure the rbacs records were not deleted/re-created; re-run migrations if the table was rebuilt.","Guard client code to only submit ids present in the last fetched rbacs list."],"exampleFix":"// before\n$collection->getById('d530aac7-1b7a-4f0d-9f0e-000000000000');\n// after\n$existing = (new RbacsService())->findAll()->indexById();\nif (!isset($existing[$requestedId])) {\n    throw new BadRequestException(\"Unknown rbac id: \" . $requestedId);\n}","handlingStrategy":"validation","validationCode":"$ids = array_column($rbacsList, 'id');\nif (!in_array($requestedId, $ids, true)) {\n    throw new InvalidArgumentException(\"Unknown rbac id: $requestedId\");\n}","typeGuard":"if (!is_string($id) || !preg_match('/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i', $id)) {\n    throw new InvalidArgumentException('Not a valid rbac id');\n}","tryCatchPattern":"try {\n    $dto = $collection->getById($id);\n} catch (NotFoundException $e) {\n    // refresh rbacs list and map ids again\n}","preventionTips":["Always fetch fresh rbacs ids before building an update payload.","Never cache rbac ids across environments or long-lived sessions.","Validate ids against the latest GET /rbacs response."],"tags":["php","cakephp","rbacs","not-found","uuid"],"backgroundTag":"record-not-found","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"}