{"record":{"id":"cbb09f6b2576836d","repo":"passbolt/passbolt_api","slug":"0-is-not-a-valid-parent-id-for-filter-1","errorCode":null,"errorMessage":"\"{0}\" is not a valid parent id for filter {1}.","messagePattern":"\"(.+?)\" is not a valid parent id for filter (.+?)\\.","errorType":"validation","errorClass":"CakeException","httpStatus":400,"severity":"error","filePath":"src/Controller/Component/QueryStringComponent.php","lineNumber":614,"sourceCode":"        return true;\n    }\n\n    /**\n     * Validate a filter that is a single parent id\n     * Examples:\n     * - Bueno: '98c2bef5-cd5f-59e7-a1a7-0107c9a7cf08'\n     * - Bueno: false\n     * - No Bueno: 'no-bueno'\n     *\n     * @param string|false $parentId uuid\n     * @param string $filtername name of filters\n     * @throw Exception if the filter is not valid\n     * @return bool if validate\n     */\n    public static function validateFilterParentFolder(string|false $parentId, string $filtername)\n    {\n        if (!Validation::uuid($parentId) && $parentId != false) {\n            throw new CakeException(__('\"{0}\" is not a valid parent id for filter {1}.', $parentId, $filtername));\n        }\n\n        return true;\n    }\n\n    /**\n     * Validate a filter that is a timestamp\n     *\n     * @param mixed $values timestamp to check\n     * @param string $filterName for error message display\n     * @throw CakeException if the filter is not valid\n     * @return bool if validate\n     */\n    public static function validateFilterTimestamp(mixed $values, string $filterName): bool\n    {\n        $timestamp = $values;\n        if (!self::isTimestamp($timestamp)) {\n            throw new CakeException(","sourceCodeStart":596,"sourceCodeEnd":632,"githubUrl":"https://github.com/passbolt/passbolt_api/blob/31c1bbc10f32808a607fa9bd81891e898779c0bc/src/Controller/Component/QueryStringComponent.php#L596-L632","documentation":"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.","triggerScenarios":"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.","commonSituations":"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 ''.","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."],"exampleFix":"// before\nGET /folders?filter[has-parent][]=MyDocuments\n// after\nGET /folders?filter[has-parent][]=98c2bef5-cd5f-59e7-a1a7-0107c9a7cf08\n// or, for root folders:\nGET /folders?filter[has-parent][]=false","handlingStrategy":"validation","validationCode":"use Cake\\Validation\\Validation;\nif ($parentId !== false && (!is_string($parentId) || !Validation::uuid($parentId))) {\n    throw new \\InvalidArgumentException(\"Not a valid parent folder UUID: \" . var_export($parentId, true));\n}","typeGuard":"function isParentFolderUuidOrNull(mixed $v): bool {\n    return $v === false || $v === null || (is_string($v) && \\Cake\\Validation\\Validation::uuid($v));\n}","tryCatchPattern":"try {\n    $ok = QueryStringComponent::validateFilterParentFolder($parentId, $filterName);\n} catch (\\Cake\\Core\\Exception\\CakeException $e) {\n    if (str_contains($e->getMessage(), 'is not a valid parent id')) {\n        return $this->response->withStatus(400, 'Parent folder filters require a UUID or false');\n    }\n    throw $e;\n}","preventionTips":["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."],"tags":["validation","uuid","query-string","folder","filter"],"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"}