passbolt/passbolt_api · error · CakeException
" " is not a valid parent id for filter .
Error message
"{0}" is not a valid parent id for filter {1}. What it means
Thrown by QueryStringComponent::validateFilterParentFolder when a single parent-folder id fails Cake\Validation::uuid() and is not falsy. false is explicitly allowed (meaning 'no parent' / root); a non-empty non-UUID value is rejected. Called per-entry by validateFilterParentFolders.
Solutions
- Replace the value with the parent folder's UUID (or use false/omit for root-level folders).
- Validate with \Cake\Validation\Validation::uuid($id) client-side before sending.
- Check upstream storage/logging for id truncation or re-encoding.
- Ensure the 'root' sentinel is sent as false, not '0' or 'false' strings, per API conventions.
Example fix
// before GET /folders?filter[has-parent][]=MyDocuments // after GET /folders?filter[has-parent][]=98c2bef5-cd5f-59e7-a1a7-0107c9a7cf08 // or, for root folders: GET /folders?filter[has-parent][]=false
Defensive patterns
Strategy: validation
Validate before calling
use Cake\Validation\Validation;
if ($parentId !== false && (!is_string($parentId) || !Validation::uuid($parentId))) {
throw new \InvalidArgumentException("Not a valid parent folder UUID: " . var_export($parentId, true));
} Type guard
function isParentFolderUuidOrNull(mixed $v): bool {
return $v === false || $v === null || (is_string($v) && \Cake\Validation\Validation::uuid($v));
} Try / catch
try {
$ok = QueryStringComponent::validateFilterParentFolder($parentId, $filterName);
} catch (\Cake\Core\Exception\CakeException $e) {
if (str_contains($e->getMessage(), 'is not a valid parent id')) {
return $this->response->withStatus(400, 'Parent folder filters require a UUID or false');
}
throw $e;
} Prevention
- Resolve folder paths/names to UUIDs before filtering.
- Use false (the documented sentinel) for root-level folders, not '0' or empty strings.
- Validate parent ids with Validation::uuid() before every request.
When it happens
Trigger: GET /folders?filter[has-parent][]=not-a-uuid, a parent folder name instead of its id, or a corrupted/truncated id. Values like '0' would be treated as falsy ($parentId != false) and slip through, but any non-empty non-UUID string throws.
Common situations: Clients pass folder names/paths instead of UUIDs; ids truncated in logs or configs; environment-specific seed data uses placeholder strings; serializers mangle the false sentinel into strings like ''.
Understand the failure class
Background: "invalid id" errors: invalid identifier format — why libraries reject IDs before lookup, and how to fix them — this error's family across 37 libraries.
Related errors
- " " is not a valid group id for filter .
- " " is not a valid user id for filter .
- " " is not a valid group filter.
- " " is not a valid parent filter.
- " " is not a valid resource id for filter .
AI-assisted analysis of passbolt/passbolt_api@31c1bbc10f (2026-09-17).
Data as JSON: /api/errors/cbb09f6b2576836d.
Report an issue: GitHub.
Appendix: source
Thrown at src/Controller/Component/QueryStringComponent.php:614
return true;
}
/**
* Validate a filter that is a single parent id
* Examples:
* - Bueno: '98c2bef5-cd5f-59e7-a1a7-0107c9a7cf08'
* - Bueno: false
* - No Bueno: 'no-bueno'
*
* @param string|false $parentId uuid
* @param string $filtername name of filters
* @throw Exception if the filter is not valid
* @return bool if validate
*/
public static function validateFilterParentFolder(string|false $parentId, string $filtername)
{
if (!Validation::uuid($parentId) && $parentId != false) {
throw new CakeException(__('"{0}" is not a valid parent id for filter {1}.', $parentId, $filtername));
}
return true;
}
/**
* Validate a filter that is a timestamp
*
* @param mixed $values timestamp to check
* @param string $filterName for error message display
* @throw CakeException if the filter is not valid
* @return bool if validate
*/
public static function validateFilterTimestamp(mixed $values, string $filterName): bool
{
$timestamp = $values;
if (!self::isTimestamp($timestamp)) {
throw new CakeException(View on GitHub (pinned to 31c1bbc10f)