{"record":{"id":"506ba765ed20badc","repo":"phacility/phabricator","slug":"in-this-poll-you-may-only-vote-for-one-option","errorCode":null,"errorMessage":"In this poll, you may only vote for one option.","messagePattern":"In this poll, you may only vote for one option\\.","errorType":"validation","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"src/applications/slowvote/controller/PhabricatorSlowvoteVoteController.php","lineNumber":54,"sourceCode":"\n    $method = $poll->getMethod();\n    $is_plurality = ($method == SlowvotePollVotingMethod::METHOD_PLURALITY);\n\n    if (!$votes) {\n      if ($is_plurality) {\n        $message = pht('You must vote for something.');\n      } else {\n        $message = pht('You must vote for at least one option.');\n      }\n\n      return $this->newDialog()\n        ->setTitle(pht('Stand For Something'))\n        ->appendParagraph($message)\n        ->addCancelButton($poll->getURI());\n    }\n\n    if ($is_plurality && count($votes) > 1) {\n      throw new Exception(\n        pht('In this poll, you may only vote for one option.'));\n    }\n\n    foreach ($votes as $vote) {\n      if (!isset($options[$vote])) {\n        throw new Exception(\n          pht(\n            'Option (\"%s\") is not a valid poll option. You may only '.\n            'vote for valid options.',\n            $vote));\n      }\n    }\n\n    $poll->openTransaction();\n      $poll->beginReadLocking();\n\n      $poll->reload();\n","sourceCodeStart":36,"sourceCodeEnd":72,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/slowvote/controller/PhabricatorSlowvoteVoteController.php#L36-L72","documentation":"PhabricatorSlowvoteVoteController throws this when a submitted ballot contains more than one selected option on a plurality (single-choice) poll ($is_plurality with count($votes) > 1). The stock UI renders radio inputs for such polls, so hitting this means a modified/hand-crafted POST, a custom client, a browser extension duplicating form fields, or a customized template rendering checkboxes for every poll.","triggerScenarios":"POSTing to a poll's vote endpoint (e.g. /V<id>/vote/) with two or more values in the votes[] fields on a poll configured for a single choice. Note empty ballots are handled earlier by a dialog; this check runs before per-option validation.","commonSituations":"Automated voting scripts; replayed/edited form submissions; template customizations that render checkboxes regardless of poll method; duplicated form fields from extensions or markup changes.","solutions":["Submit exactly one option ID for plurality polls","If you customized poll templates, render single-choice inputs (radio behavior) for plurality polls and multi-select only for approval polls","If this fires from normal UI use, check for browser extensions or scripts duplicating the votes[] fields"],"exampleFix":"# before: multiple selections on a single-choice poll\ncurl -b cookies -d \"votes[]=101&votes[]=102\" https://phab.example.com/V1/vote/\n\n# after: one selection\ncurl -b cookies -d \"votes[]=102\" https://phab.example.com/V1/vote/","handlingStrategy":"validation","validationCode":"// Client-side, before POSTing a ballot\nif (poll.isPlurality && selectedOptionIds.length > 1) {\n  // block submit: single-choice polls accept exactly one option\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Render radio-style single selection for plurality polls; multi-select only for approval polls","Validate the selection count against the poll method before POST","Keep form markup free of duplicated votes[] fields; test with browser extensions disabled"],"tags":["slowvote","forms","business-rule","controller","http-post"],"backgroundTag":"business-rule-violation","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}