{"record":{"id":"d4f9bbb92ddc4016","repo":"phacility/phabricator","slug":"specified-maximum-date-must-come-after-specified-m","errorCode":null,"errorMessage":"Specified maximum date must come after specified minimum date.","messagePattern":"Specified maximum date must come after specified minimum date\\.","errorType":"exception","errorClass":"PhutilArgumentUsageException","httpStatus":null,"severity":"error","filePath":"src/applications/audit/management/PhabricatorAuditManagementDeleteWorkflow.php","lineNumber":74,"sourceCode":"            'param' => 'ids',\n            'help' => pht('Select only audits with the given IDs.'),\n          ),\n        ));\n  }\n\n  public function execute(PhutilArgumentParser $args) {\n    $viewer = $this->getViewer();\n    $users = $this->loadUsers($args->getArg('users'));\n    $repos = $this->loadRepos($args->getArg('repositories'));\n    $commits = $this->loadCommits($args->getArg('commits'));\n    $ids = $this->parseList($args->getArg('ids'));\n\n    $status = $args->getArg('status');\n\n    $min_date = $this->loadDate($args->getArg('min-commit-date'));\n    $max_date = $this->loadDate($args->getArg('max-commit-date'));\n    if ($min_date && $max_date && ($min_date > $max_date)) {\n      throw new PhutilArgumentUsageException(\n        pht('Specified maximum date must come after specified minimum date.'));\n    }\n\n    $is_dry_run = $args->getArg('dry-run');\n\n    $query = id(new DiffusionCommitQuery())\n      ->setViewer($this->getViewer())\n      ->needAuditRequests(true);\n\n    if ($status) {\n      $query->withStatuses(array($status));\n    }\n\n    $id_map = array();\n    if ($ids) {\n      $id_map = array_fuse($ids);\n      $query->withAuditIDs($ids);\n    }","sourceCodeStart":56,"sourceCodeEnd":92,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/audit/management/PhabricatorAuditManagementDeleteWorkflow.php#L56-L92","documentation":"Thrown by the audit delete workflow (bin/audit delete) when both --min-commit-date and --max-commit-date are supplied and the minimum is strictly greater than the maximum. Dates are compared as loaded values (loadDate), so an inverted range is rejected before any query runs — protecting you from selecting the wrong set of audit data to delete.","triggerScenarios":"Passing --min-commit-date 2024-12-01 --max-commit-date 2024-01-01 (arguments swapped), or mixing formats so the parsed min lands after max.","commonSituations":"Copy-pasting a command template and swapping the flags; timezone confusion when using relative or local-time formats around midnight/year boundaries.","solutions":["Swap the two flags so the earlier date is --min-commit-date and the later is --max-commit-date","Re-run with --dry-run first to see what would be deleted before doing it for real","Use unambiguous absolute dates (YYYY-MM-DD) to avoid parse surprises"],"exampleFix":"# before\n$ bin/audit delete --min-commit-date 2024-12-01 --max-commit-date 2024-01-01\n# after\n$ bin/audit delete --min-commit-date 2024-01-01 --max-commit-date 2024-12-01 --dry-run","handlingStrategy":"validation","validationCode":"$min = strtotime($args->getArg('min-commit-date'));\n$max = strtotime($args->getArg('max-commit-date'));\nif ($min !== false && $max !== false && $min > $max) {\n  throw new InvalidArgumentException('min-commit-date must be <= max-commit-date');\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always run destructive audit commands with --dry-run first","Use absolute YYYY-MM-DD dates in scripts to avoid timezone/parsing drift"],"tags":["audit","cli","date-validation","phabricator"],"backgroundTag":"invalid-date-range","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}