phacility/phabricator · error · Exception

You have no accounts!

Error message

You have no accounts!

What it means

Thrown by PhortuneCartSearchEngine when building the cart query: the viewer has neither a merchant context nor an account context, and is not a member of any Phortune account. Phortune always scopes cart listings to a billing account, so a viewer with zero accounts has no valid scope. The engine throws instead of running an unscoped query that could leak other users' carts.

Source

Thrown at src/applications/phortune/query/PhortuneCartSearchEngine.php:75

    $query = id(new PhortuneCartQuery())
      ->needPurchases(true);

    $viewer = $this->requireViewer();

    $merchant = $this->getMerchant();
    $account = $this->getAccount();
    if ($merchant) {
      $query->withMerchantPHIDs(array($merchant->getPHID()));
    } else if ($account) {
      $query->withAccountPHIDs(array($account->getPHID()));
    } else {
      $accounts = id(new PhortuneAccountQuery())
        ->withMemberPHIDs(array($viewer->getPHID()))
        ->execute();
      if ($accounts) {
        $query->withAccountPHIDs(mpull($accounts, 'getPHID'));
      } else {
        throw new Exception(pht('You have no accounts!'));
      }
    }

    $subscription = $this->getSubscription();
    if ($subscription) {
      $query->withSubscriptionPHIDs(array($subscription->getPHID()));
    }

    if ($saved->getParameter('invoices')) {
      $query->withInvoices(true);
    } else {
      $query->withStatuses(
        array(
          PhortuneCart::STATUS_PURCHASING,
          PhortuneCart::STATUS_CHARGED,
          PhortuneCart::STATUS_HOLD,
          PhortuneCart::STATUS_REVIEW,
          PhortuneCart::STATUS_PURCHASED,

View on GitHub (pinned to 5720a38cfe)

Solutions

  1. Create a Phortune account (or have an admin add the user to one), then reload the cart list.
  2. Give the engine a scope the viewer can see by setting an account or merchant context on it before querying.
  3. In custom code, run PhortuneAccountQuery with the viewer first and redirect to account creation when it returns nothing, instead of invoking the engine.
  4. Verify the user's account memberships were not removed by an admin or policy change.

Example fix

// before
$engine = id(new PhortuneCartSearchEngine())
  ->setViewer($viewer);
// viewer has no merchant/account context and no account memberships:
$response = $engine->buildResponse($request, $saved_query); // throws 'You have no accounts!'

// after
$accounts = id(new PhortuneAccountQuery())
  ->setViewer($viewer)
  ->withMemberPHIDs(array($viewer->getPHID()))
  ->execute();
if (!$accounts) {
  return new Aphront404Response(); // or redirect to Phortune account creation
}
$response = $engine->buildResponse($request, $saved_query);
Defensive patterns

Strategy: validation

Validate before calling

$accounts = id(new PhortuneAccountQuery())
  ->setViewer($viewer)
  ->withMemberPHIDs(array($viewer->getPHID()))
  ->execute();
if (!$accounts) {
  // Do not invoke the search engine; create an account first
  return $this->newDialog()->setTitle(pht('You have no accounts!'));
}

Prevention

When it happens

Trigger: Loading the Phortune cart list (e.g. /phortune/cart/) or invoking PhortuneCartSearchEngine's query building when getMerchant() and getAccount() both return null and PhortuneAccountQuery->withMemberPHIDs(array($viewer->getPHID()))->execute() returns no rows.

Common situations: A fresh Phabricator install where the first user opens Phortune before creating a billing account; users who were added to a merchant but never to an account; bots or dashboard panels that run the search engine as a viewer with no Phortune account membership.

Related errors


AI-assisted analysis of phacility/phabricator@5720a38cfe (2026-08-21). Data as JSON: /api/errors/bf41ea43d271fcf3. Report an issue: GitHub.