{"record":{"id":"90f2e4928185f191","repo":"phacility/phabricator","slug":"message-type-s-is-unknown-supported-message-ty","errorCode":null,"errorMessage":"Message type \"%s\" is unknown, supported message types are: %s.","messagePattern":"Message type \"(.+?)\" is unknown, supported message types are: (.+?)\\.","errorType":"console","errorClass":"PhutilArgumentUsageException","httpStatus":null,"severity":"warning","filePath":"src/applications/metamta/management/PhabricatorMailManagementSendTestWorkflow.php","lineNumber":83,"sourceCode":"            'param' => 'message-type',\n            'help' => pht(\n              'Send the specified type of message (email, sms, ...).'),\n          ),\n        ));\n  }\n\n  public function execute(PhutilArgumentParser $args) {\n    $console = PhutilConsole::getConsole();\n    $viewer = $this->getViewer();\n\n    $type = $args->getArg('type');\n    if ($type === null || !strlen($type)) {\n      $type = PhabricatorMailEmailMessage::MESSAGETYPE;\n    }\n\n    $type_map = PhabricatorMailExternalMessage::getAllMessageTypes();\n    if (!isset($type_map[$type])) {\n      throw new PhutilArgumentUsageException(\n        pht(\n          'Message type \"%s\" is unknown, supported message types are: %s.',\n          $type,\n          implode(', ', array_keys($type_map))));\n    }\n\n    $from = $args->getArg('from');\n    if ($from) {\n      $user = id(new PhabricatorPeopleQuery())\n        ->setViewer($viewer)\n        ->withUsernames(array($from))\n        ->executeOne();\n      if (!$user) {\n        throw new PhutilArgumentUsageException(\n          pht(\"No such user '%s' exists.\", $from));\n      }\n      $from = $user;\n    }","sourceCodeStart":65,"sourceCodeEnd":101,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/metamta/management/PhabricatorMailManagementSendTestWorkflow.php#L65-L101","documentation":"Thrown by the `bin/mail send-test` management workflow when the value passed to `--type` is not a key in the map returned by PhabricatorMailExternalMessage::getAllMessageTypes(). That map is built from all installed message-type classes, which in a stock install are PhabricatorMailEmailMessage ('email') and PhabricatorMailSMSMessage ('sms'). It is a PhutilArgumentUsageException, so the command aborts before doing any work; the message itself lists the exact supported type keys.","triggerScenarios":"Running `bin/mail send-test --type <value>` where <value> is a typo (e.g. 'emial'), a type whose backing class is not installed (e.g. 'sms' on an install without SMS support), or a custom PhabricatorMailExternalMessage subclass whose getMessageTypeKey() returns a different key than the one typed on the command line.","commonSituations":"Assuming SMS testing works before any SMS mailer/message class is present; developing a custom message type and guessing its key instead of reading the constant; copy-pasting a --type value from documentation for a different Phabricator version.","solutions":["Re-run the command: the exception message enumerates every supported type key; use one of them exactly (normally 'email' or 'sms').","Omit --type entirely; the workflow defaults to PhabricatorMailEmailMessage::MESSAGETYPE ('email').","If you expect a custom type, grep the codebase for classes extending PhabricatorMailExternalMessage and check their MESSAGETYPE constant.","Verify the class is actually loaded in the install you are testing (correct web/phd vs CLI checkout, extensions enabled)."],"exampleFix":"// before\n$ bin/mail send-test --to alincoln --type emial\n// Exception: Message type \"emial\" is unknown, supported message types are: email, sms.\n\n// after\n$ bin/mail send-test --to alincoln --type email","handlingStrategy":"validation","validationCode":"// Before invoking send-test, check the type key against the same map the workflow uses:\n$type_map = PhabricatorMailExternalMessage::getAllMessageTypes();\n$type = $argv_type ?: PhabricatorMailEmailMessage::MESSAGETYPE;\nif (!isset($type_map[$type])) {\n  fwrite(STDERR, sprintf(\"Unsupported type '%s'. Supported: %s\\n\", $type, implode(', ', array_keys($type_map))));\n  exit(1);\n}","typeGuard":null,"tryCatchPattern":"try {\n  // invoke the workflow\n} catch (PhutilArgumentUsageException $ex) {\n  fwrite(STDERR, $ex->getMessage().\"\\n\");\n  exit(1);\n}","preventionTips":["Reference the message type via class constants (PhabricatorMailEmailMessage::MESSAGETYPE) instead of string literals.","Omit --type when testing standard email delivery.","When adding custom message types, expose the key in your tooling by reading getAllMessageTypes(), never hardcoding it."],"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"}