passbolt/passbolt_api · error · Cake\Http\Exception\NotFoundException

The user does not exist.

Error message

The user does not exist.

What it means

After building the user query (including MFA decoration), the controller wraps `$query->first()` in a try/catch: any exception from the database layer (e.g. malformed UUID reaching the query, SQL error from the MFA decoration query) is swallowed and re-thrown as a 404 NotFoundException 'The user does not exist.' to avoid leaking storage errors.

Solutions

  1. Run migrations for the MFA plugin (`passbolt migrate` / `bin/cake passbolt migrate`) so IsMfaEnabledQueryService finds its tables.
  2. Check database connectivity and server logs (logs/error.log) for the underlying exception the 404 masks.
  3. Confirm the requested id is a valid, existing user UUID.
  4. If the user genuinely does not exist, this is expected — list users via GET /users.json to get valid ids.
Defensive patterns

Strategy: try-catch

Try / catch

try {
  const res = await api.get(`/users/${uuid}.json`);
} catch (e) {
  if (e.response?.status === 404) {
    // Masked query failure (MFA decoration/DB issue) or missing user:
    // check server logs and run migrations before assuming the user is absent.
    console.warn('User lookup failed; verify user exists and MFA migrations are applied.');
    return null;
  }
  throw e;
}

Prevention

When it happens

Trigger: GET /users/{id}.json where executing the decorated query throws — most commonly when the MFA decoration query (IsMfaEnabledQueryService::decorateForView) fails, or the id passed to the query is malformed/unusable by the driver.

Common situations: MFA plugin tables missing/mis-migrated so the decoration query errors; database connectivity issues; a non-UUID id slipping through to the query layer; DB driver differences (Postgres vs MySQL) causing the MFA subquery to fail.

Understand the failure class

Background: "User not found", "Invalid user", and "does not exist": what missing-user lookup errors mean across Rocket.Chat, LiteLLM, Phabricator, rustfs, and pnpm — this error's family across 10 libraries.

Related errors


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

Appendix: source

Thrown at src/Controller/Users/UsersViewController.php:79

        // Trigger an event to filter data, decorate results, add contain, etc.
        $event = TableFindIndexBefore::create(
            $query,
            FindIndexOptions::createFromArray(['query' => $query]),
            $usersTable
        );
        /** @var \App\Model\Event\TableFindIndexBefore $event */
        $this->getEventManager()->dispatch($event);
        $query = $event->getQuery();

        if ($this->isFeaturePluginEnabled('MultiFactorAuthentication')) {
            (new IsMfaEnabledQueryService())->decorateForView($query, $this->User->getAccessControl(), $id);
        }

        try {
            $user = $query->first();
        } catch (Exception $exception) {
            throw new NotFoundException(__('The user does not exist.'));
        }
        if (empty($user)) {
            throw new NotFoundException(__('The user does not exist.'));
        }

        $this->success(__('The operation was successful.'), $user);
    }
}

View on GitHub (pinned to 31c1bbc10f)