passbolt/passbolt_api · error · NotFoundException
Record not found
Error message
Record not found
What it means
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.
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.
Example fix
// before
$collection->getById('d530aac7-1b7a-4f0d-9f0e-000000000000');
// after
$existing = (new RbacsService())->findAll()->indexById();
if (!isset($existing[$requestedId])) {
throw new BadRequestException("Unknown rbac id: " . $requestedId);
} Defensive patterns
Strategy: validation
Validate before calling
$ids = array_column($rbacsList, 'id');
if (!in_array($requestedId, $ids, true)) {
throw new InvalidArgumentException("Unknown rbac id: $requestedId");
} Type guard
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)) {
throw new InvalidArgumentException('Not a valid rbac id');
} Try / catch
try {
$dto = $collection->getById($id);
} catch (NotFoundException $e) {
// refresh rbacs list and map ids again
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: Record Not Found Errors: "not found", RecordNotFound, and "was not found" — what they mean and how to fix them — this error's family across 28 libraries.
Related errors
- The request data is invalid: id invalid.
- Could not save the rbacs, please try again later.
- The authentication token id is invalid.
- The rbacs could not be saved.
- The request data is empty.
AI-assisted analysis of passbolt/passbolt_api@31c1bbc10f (2026-09-17).
Data as JSON: /api/errors/07d0dd81f11fddbc.
Report an issue: GitHub.
Appendix: source
Thrown at plugins/PassboltCe/Rbacs/src/Model/Dto/RbacsUpdateDtoCollection.php:78
public function getIds(): array
{
return (array)Hash::extract($this->data, '{n}.id');
}
/**
* Get an item from the collection using the id
*
* @param string $id uuid
* @return array data {id:<uuid>, control_function:<string>}
*/
public function getById(string $id): array
{
if (!Validation::uuid($id)) {
throw new InvalidArgumentException(__('The identifier should be a valid UUID.') . ' ' . $id);
}
$result = (array)Hash::extract($this->data, '{n}[id=' . $id . ']');
if (!count($result)) {
throw new NotFoundException(__('Record not found') . ' ' . $id);
}
return $result[0];
}
/**
* @return int
*/
public function count(): int
{
return count($this->data);
}
/**
* Assert the whole data set is correct
*
* @throw BadRequestException if data is invalid
* @param array $data data [{id:<uuid>, control_function:<string>},...]View on GitHub (pinned to 31c1bbc10f)