{"record":{"id":"062a005ee55c91ad","repo":"phacility/phabricator","slug":"argument-s-is-not-a-valid-message-id","errorCode":null,"errorMessage":"Argument \"%s\" is not a valid message ID.","messagePattern":"Argument \"(.+?)\" is not a valid message ID\\.","errorType":"console","errorClass":"PhutilArgumentUsageException","httpStatus":null,"severity":"warning","filePath":"src/applications/metamta/management/PhabricatorMailManagementShowOutboundWorkflow.php","lineNumber":42,"sourceCode":"              'file and then open it in a browser.'),\n          ),\n        ));\n  }\n\n  public function execute(PhutilArgumentParser $args) {\n    $console = PhutilConsole::getConsole();\n\n    $ids = $args->getArg('id');\n    if (!$ids) {\n      throw new PhutilArgumentUsageException(\n        pht(\n          \"Use the '%s' flag to specify one or more messages to show.\",\n          '--id'));\n    }\n\n    foreach ($ids as $id) {\n      if (!ctype_digit($id)) {\n        throw new PhutilArgumentUsageException(\n          pht(\n            'Argument \"%s\" is not a valid message ID.',\n            $id));\n      }\n    }\n\n    $messages = id(new PhabricatorMetaMTAMail())->loadAllWhere(\n      'id IN (%Ld)',\n      $ids);\n\n    if ($ids) {\n      $ids = array_fuse($ids);\n      $missing = array_diff_key($ids, $messages);\n      if ($missing) {\n        throw new PhutilArgumentUsageException(\n          pht(\n            'Some specified messages do not exist: %s',\n            implode(', ', array_keys($missing))));","sourceCodeStart":24,"sourceCodeEnd":60,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/metamta/management/PhabricatorMailManagementShowOutboundWorkflow.php#L24-L60","documentation":"show-outbound validates every --id value with ctype_digit() before querying: each must be a plain string of decimal digits. Negative numbers (leading '-'), whitespace, hex, scientific notation, or any non-digit character fails. The check exists because the IDs are interpolated into an `%Ld` (list of integers) query.","triggerScenarios":"`--id -5`, `--id 12a`, `--id 1e3`, `--id ' 123'`, or IDs assembled by string concatenation that leaves stray characters.","commonSituations":"Generated command lines from templates that include formatting characters; locales or tools that insert grouping separators into numbers.","solutions":["Pass plain positive integers, e.g. `--id 123`.","Sanitize generated IDs: strip non-digits (`preg_replace('/[^0-9]/', '', $id)`) before building the command.","Reject zero-padded or signed values at the source rather than on the command line."],"exampleFix":"// before\n$ bin/mail show-outbound --id '#456'\n// Exception: Argument \"#456\" is not a valid message ID.\n\n// after\n$ bin/mail show-outbound --id 456","handlingStrategy":"type-guard","validationCode":null,"typeGuard":"// Guard each ID with the exact rule the workflow applies (ctype_digit):\nfunction is_valid_mail_id($id) {\n  return is_string($id) && ctype_digit($id);\n}\n$ids = array_values(array_filter($ids, 'is_valid_mail_id'));\nif (!$ids) {\n  fwrite(STDERR, \"No valid message IDs.\\n\");\n  exit(1);\n}","tryCatchPattern":null,"preventionTips":["Pass plain positive integers; never signed or formatted numbers.","Filter generated IDs with ctype_digit before building the command line.","Reject '#' prefixes and whitespace at the source."],"tags":["php","phabricator","cli","argument-validation","mail"],"backgroundTag":"invalid-cli-argument","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}