{"record":{"id":"c23c4b98a585e6ea","repo":"passbolt/passbolt_api","slug":"the-request-data-is-invalid-id-invalid","errorCode":null,"errorMessage":"The request data is invalid: id invalid.","messagePattern":"The request data is invalid: id invalid\\.","errorType":"http","errorClass":"BadRequestException","httpStatus":400,"severity":"error","filePath":"plugins/PassboltCe/Rbacs/src/Model/Dto/RbacsUpdateDtoCollection.php","lineNumber":130,"sourceCode":"    }\n\n    /**\n     * Assert a given data entry\n     *\n     * @throw BadRequestException if entry doesn't match the expected format\n     * @param array $entry entry {id:<uuid>, control_function:<string>}\n     * @return void\n     */\n    public function assertEntry(array $entry): void\n    {\n        if (count($entry) > 2) {\n            throw new BadRequestException(__('The request data is invalid: invalid fields.'));\n        }\n        if (!isset($entry['id'])) {\n            throw new BadRequestException(__('The request data is invalid: id missing.'));\n        }\n        if (!is_string($entry['id']) || !Validation::uuid($entry['id'])) {\n            throw new BadRequestException(__('The request data is invalid: id invalid.'));\n        }\n        if (!isset($entry['control_function'])) {\n            throw new BadRequestException(__('The request data is invalid: control_function missing.'));\n        }\n        if (!is_string($entry['control_function']) || !Validation::ascii($entry['control_function'])) {\n            throw new BadRequestException(__('The request data is invalid: control_function invalid.'));\n        }\n    }\n\n    /**\n     * Assert data contains only one occurence of each id\n     *\n     * @throw BadRequestException if multiple entries with same id is sent\n     * @param array $data data [{id:<uuid>, control_function:<string>},...] where id values must be unique\n     * @return void\n     */\n    public function assertUniqueIds(array $data): void\n    {","sourceCodeStart":112,"sourceCodeEnd":148,"githubUrl":"https://github.com/passbolt/passbolt_api/blob/31c1bbc10f32808a607fa9bd81891e898779c0bc/plugins/PassboltCe/Rbacs/src/Model/Dto/RbacsUpdateDtoCollection.php#L112-L148","documentation":"Type/format check in RbacsUpdateDtoCollection::assertEntry(): the 'id' of each RBAC update entry must be a string holding a valid UUID. Fires when the id is present but not a string or not a UUID (e.g. an integer or garbage value), so the entry cannot reference an existing RBAC row and the update is rejected with HTTP 400.","triggerScenarios":"Sending id as an integer, null, empty string, or a non-UUID string (e.g. \"123\", \"abc\", a role name) in the PUT /rbacs/update body.","commonSituations":"Client using database auto-increment ids instead of UUIDs, ids truncated or mangled by string handling, or passing the role id instead of the rbac id.","solutions":["Send a proper RFC 4122 UUID string for the rbac id.","Fix the client to use the id field from GET /rbacs responses verbatim.","Add client-side UUID format validation before submitting.","Confirm you are not substituting role id or numeric keys for the rbac id."],"exampleFix":"// before\n{\"id\": 42, \"control_function\":\"allow\"}\n// after\n{\"id\":\"d530aac7-1b7a-4f0d-9f0e-2c1b9a8d7e6f\",\"control_function\":\"allow\"}","handlingStrategy":"validation","validationCode":"use Cake\\Validation\\Validation;\nforeach ($entries as $e) {\n    if (!isset($e['id']) || !is_string($e['id']) || !Validation::uuid($e['id'])) {\n        throw new InvalidArgumentException('rbacs update id must be a UUID string');\n    }\n}","typeGuard":"function isUuidString(mixed $v): bool {\n    return is_string($v) && preg_match('/^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i', $v) === 1;\n}","tryCatchPattern":"try {\n    $collection = new RbacsUpdateDtoCollection($data);\n} catch (BadRequestException $e) {\n    // id format invalid: re-fetch ids\n}","preventionTips":["Copy ids verbatim from GET /rbacs responses.","Never substitute numeric ids or role ids for rbac ids.","Add UUID format validation in the client before submitting."],"tags":["php","cakephp","rbacs","bad-request","uuid","validation"],"backgroundTag":"invalid-identifier-format","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"}