{"record":{"id":"8e2565a4e1a31e79","repo":"passbolt/passbolt_api","slug":"the-request-data-is-invalid-id-missing","errorCode":null,"errorMessage":"The request data is invalid: id missing.","messagePattern":"The request data is invalid: id missing\\.","errorType":"http","errorClass":"BadRequestException","httpStatus":400,"severity":"error","filePath":"plugins/PassboltCe/Rbacs/src/Model/Dto/RbacsUpdateDtoCollection.php","lineNumber":127,"sourceCode":"        }\n\n        $this->assertUniqueIds($data);\n    }\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","sourceCodeStart":109,"sourceCodeEnd":145,"githubUrl":"https://github.com/passbolt/passbolt_api/blob/31c1bbc10f32808a607fa9bd81891e898779c0bc/plugins/PassboltCe/Rbacs/src/Model/Dto/RbacsUpdateDtoCollection.php#L109-L145","documentation":"Required-field check in RbacsUpdateDtoCollection::assertEntry(): every entry in the RBAC update payload must include an 'id' key identifying the permission to change. Fires when an entry omits the id — the client cannot say which RBAC to update — so the request is rejected with HTTP 400; the payload must be resent with each entry containing a valid id.","triggerScenarios":"Sending an entry like {\"control_function\":\"allow\"} without an id in the PUT /rbacs/update body.","commonSituations":"Client building payloads from partially loaded data, a field named differently (e.g. rbacId), or object-to-array serialization dropping the id (e.g. casting an entity with hidden id).","solutions":["Add the id (valid UUID of the rbac) to each entry.","Check client serialization so the id key is not dropped or renamed.","Validate entries client-side before sending.","Fetch fresh rbacs from GET /rbacs to obtain correct ids."],"exampleFix":"// before\n{\"control_function\":\"allow\"}\n// after\n{\"id\":\"d530aac7-1b7a-4f0d-9f0e-2c1b9a8d7e6f\",\"control_function\":\"allow\"}","handlingStrategy":"validation","validationCode":"foreach ($entries as $e) {\n    if (!isset($e['id'])) {\n        throw new InvalidArgumentException('rbacs update entry missing id');\n    }\n}","typeGuard":"function hasId(mixed $e): bool {\n    return is_array($e) && array_key_exists('id', $e);\n}","tryCatchPattern":"try {\n    $collection = new RbacsUpdateDtoCollection($data);\n} catch (BadRequestException $e) {\n    // entries must carry id\n}","preventionTips":["Always build entries from fetched rbac rows that include id.","Avoid entity-to-array conversions that hide the id field.","Validate required keys client-side before sending."],"tags":["php","cakephp","rbacs","bad-request","missing-field"],"backgroundTag":"missing-required-argument","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"}