{"record":{"id":"bf41ea43d271fcf3","repo":"phacility/phabricator","slug":"you-have-no-accounts","errorCode":null,"errorMessage":"You have no accounts!","messagePattern":"You have no accounts!","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"src/applications/phortune/query/PhortuneCartSearchEngine.php","lineNumber":75,"sourceCode":"    $query = id(new PhortuneCartQuery())\n      ->needPurchases(true);\n\n    $viewer = $this->requireViewer();\n\n    $merchant = $this->getMerchant();\n    $account = $this->getAccount();\n    if ($merchant) {\n      $query->withMerchantPHIDs(array($merchant->getPHID()));\n    } else if ($account) {\n      $query->withAccountPHIDs(array($account->getPHID()));\n    } else {\n      $accounts = id(new PhortuneAccountQuery())\n        ->withMemberPHIDs(array($viewer->getPHID()))\n        ->execute();\n      if ($accounts) {\n        $query->withAccountPHIDs(mpull($accounts, 'getPHID'));\n      } else {\n        throw new Exception(pht('You have no accounts!'));\n      }\n    }\n\n    $subscription = $this->getSubscription();\n    if ($subscription) {\n      $query->withSubscriptionPHIDs(array($subscription->getPHID()));\n    }\n\n    if ($saved->getParameter('invoices')) {\n      $query->withInvoices(true);\n    } else {\n      $query->withStatuses(\n        array(\n          PhortuneCart::STATUS_PURCHASING,\n          PhortuneCart::STATUS_CHARGED,\n          PhortuneCart::STATUS_HOLD,\n          PhortuneCart::STATUS_REVIEW,\n          PhortuneCart::STATUS_PURCHASED,","sourceCodeStart":57,"sourceCodeEnd":93,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/phortune/query/PhortuneCartSearchEngine.php#L57-L93","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Create a Phortune account (or have an admin add the user to one), then reload the cart list.","Give the engine a scope the viewer can see by setting an account or merchant context on it before querying.","In custom code, run PhortuneAccountQuery with the viewer first and redirect to account creation when it returns nothing, instead of invoking the engine.","Verify the user's account memberships were not removed by an admin or policy change."],"exampleFix":"// before\n$engine = id(new PhortuneCartSearchEngine())\n  ->setViewer($viewer);\n// viewer has no merchant/account context and no account memberships:\n$response = $engine->buildResponse($request, $saved_query); // throws 'You have no accounts!'\n\n// after\n$accounts = id(new PhortuneAccountQuery())\n  ->setViewer($viewer)\n  ->withMemberPHIDs(array($viewer->getPHID()))\n  ->execute();\nif (!$accounts) {\n  return new Aphront404Response(); // or redirect to Phortune account creation\n}\n$response = $engine->buildResponse($request, $saved_query);","handlingStrategy":"validation","validationCode":"$accounts = id(new PhortuneAccountQuery())\n  ->setViewer($viewer)\n  ->withMemberPHIDs(array($viewer->getPHID()))\n  ->execute();\nif (!$accounts) {\n  // Do not invoke the search engine; create an account first\n  return $this->newDialog()->setTitle(pht('You have no accounts!'));\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Create a Phortune account before exposing cart, charge, or subscription lists to a user.","When embedding Phortune search engines, always pass an explicit account or merchant context.","Test payment screens with a freshly registered user that has no account memberships."],"tags":["phortune","phabricator","php","payments","search-engine","account-scope"],"backgroundTag":"missing-payment-account","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}