passbolt/passbolt_api · error · CakeException

" " is not a valid group id for filter .

Error message

"{0}" is not a valid group id for filter {1}.

What it means

Thrown by QueryStringComponent::validateFilterGroup when a single group id fails Cake\Validation::uuid(). This method is called both directly by validateFilters and per-entry by validateFilterGroups, so it fires whenever any group id in a group filter is not a well-formed UUID.

Solutions

  1. Replace the value with the group's UUID (look it up via GET /groups).
  2. Validate each id with \Cake\Validation\Validation::uuid() before sending.
  3. Check that ids were not transformed (dashes stripped, uppercased prefixes added, truncated) upstream.
  4. Update legacy clients to UUID identifiers.

Example fix

// before
GET /resources?filter[has-groups][]=marketing-team
// after
GET /resources?filter[has-groups][]=98c2bef5-cd5f-59e7-a1a7-0107c9a7cf08
Defensive patterns

Strategy: validation

Validate before calling

use Cake\Validation\Validation;
if (!Validation::uuid($groupId)) {
    throw new \InvalidArgumentException("Not a valid group UUID: " . var_export($groupId, true));
}

Type guard

function isGroupUuid(mixed $v): bool {
    return is_string($v) && \Cake\Validation\Validation::uuid($v);
}

Try / catch

try {
    $ok = QueryStringComponent::validateFilterGroup($groupId, $filterName);
} catch (\Cake\Core\Exception\CakeException $e) {
    if (str_contains($e->getMessage(), 'is not a valid group id')) {
        return $this->response->withStatus(400, 'Group filters require UUID ids');
    }
    throw $e;
}

Prevention

When it happens

Trigger: GET /resources?filter[has-groups][]=marketing (a group name instead of id), a truncated/dashed-stripped UUID, or any non-UUID string under an otherwise valid list filter.

Common situations: Clients pass group names or slugs; ids come from another system with different formats; copy-paste truncation; legacy integrations using numeric ids.

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


AI-assisted analysis of passbolt/passbolt_api@31c1bbc10f (2026-09-17). Data as JSON: /api/errors/658fd1cdff6828d8. Report an issue: GitHub.

Appendix: source

Thrown at src/Controller/Component/QueryStringComponent.php:591

        return true;
    }

    /**
     * Validate a filter that is a single group id
     * Examples:
     * - Bueno: '98c2bef5-cd5f-59e7-a1a7-0107c9a7cf08'
     * - No Bueno: 'no-bueno'
     *
     * @param mixed $groupId Value to check.
     * @param string $filterName name of filters
     * @throw CakeException if the filter is not valid
     * @return bool if validate
     */
    public static function validateFilterGroup(mixed $groupId, string $filterName): bool
    {
        if (!Validation::uuid($groupId)) {
            throw new CakeException(
                __('"{0}" is not a valid group id for filter {1}.', $groupId, $filterName)
            );
        }

        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

View on GitHub (pinned to 31c1bbc10f)