phacility/phabricator · warning · PhutilArgumentUsageException
Message type "%s" is unknown, supported message types are: %
Error message
Message type "%s" is unknown, supported message types are: %s.
What it means
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.
Source
Thrown at src/applications/metamta/management/PhabricatorMailManagementSendTestWorkflow.php:83
'param' => 'message-type',
'help' => pht(
'Send the specified type of message (email, sms, ...).'),
),
));
}
public function execute(PhutilArgumentParser $args) {
$console = PhutilConsole::getConsole();
$viewer = $this->getViewer();
$type = $args->getArg('type');
if ($type === null || !strlen($type)) {
$type = PhabricatorMailEmailMessage::MESSAGETYPE;
}
$type_map = PhabricatorMailExternalMessage::getAllMessageTypes();
if (!isset($type_map[$type])) {
throw new PhutilArgumentUsageException(
pht(
'Message type "%s" is unknown, supported message types are: %s.',
$type,
implode(', ', array_keys($type_map))));
}
$from = $args->getArg('from');
if ($from) {
$user = id(new PhabricatorPeopleQuery())
->setViewer($viewer)
->withUsernames(array($from))
->executeOne();
if (!$user) {
throw new PhutilArgumentUsageException(
pht("No such user '%s' exists.", $from));
}
$from = $user;
}View on GitHub (pinned to 5720a38cfe)
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).
Example fix
// before $ bin/mail send-test --to alincoln --type emial // Exception: Message type "emial" is unknown, supported message types are: email, sms. // after $ bin/mail send-test --to alincoln --type email
Defensive patterns
Strategy: validation
Validate before calling
// Before invoking send-test, check the type key against the same map the workflow uses:
$type_map = PhabricatorMailExternalMessage::getAllMessageTypes();
$type = $argv_type ?: PhabricatorMailEmailMessage::MESSAGETYPE;
if (!isset($type_map[$type])) {
fwrite(STDERR, sprintf("Unsupported type '%s'. Supported: %s\n", $type, implode(', ', array_keys($type_map))));
exit(1);
} Try / catch
try {
// invoke the workflow
} catch (PhutilArgumentUsageException $ex) {
fwrite(STDERR, $ex->getMessage()."\n");
exit(1);
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Specify one or more users to send a message to with "--to" a
- Use the '%s' flag to specify one or more messages to show.
- Use the '%s' flag to specify one or more messages to show.
- Argument "%s" is not a valid message ID.
- No such user '%s' exists.
AI-assisted analysis of phacility/phabricator@5720a38cfe (2026-08-21).
Data as JSON: /api/errors/90f2e4928185f191.
Report an issue: GitHub.