phacility/phabricator · error · Exception
Adapter ("%s") is configured for medium "%s", but this is no
Error message
Adapter ("%s") is configured for medium "%s", but this is not a supported delivery medium. Supported media are: %s. What it means
PhabricatorMailAdapter::setMedia() configures which delivery media (message types, e.g. 'email', 'sms') a mailer accepts. Each adapter declares its native capabilities via getSupportedMessageTypes(); setMedia() walks the supplied list and throws immediately when a medium is not in that native map, naming the adapter class, the offending medium, and the supported set. It fires at mailer-configuration load time, before any message is sent.
Source
Thrown at src/applications/metamta/adapter/PhabricatorMailAdapter.php:64
$config_map = $this->media;
$config_map = array_fuse($config_map);
$media_map = array_intersect_key($media_map, $config_map);
}
$this->mediaMap = $media_map;
}
return isset($this->mediaMap[$message_type]);
}
final public function setMedia(array $media) {
$native_map = $this->getSupportedMessageTypes();
$native_map = array_fuse($native_map);
foreach ($media as $medium) {
if (!isset($native_map[$medium])) {
throw new Exception(
pht(
'Adapter ("%s") is configured for medium "%s", but this is not '.
'a supported delivery medium. Supported media are: %s.',
get_class($this),
$medium,
implode(', ', $native_map)));
}
}
$this->media = $media;
$this->mediaMap = null;
return $this;
}
final public function getMedia() {
return $this->media;
}
View on GitHub (pinned to 5720a38cfe)
Solutions
- Remove the unsupported medium from that mailer's 'media' list - email adapters (mailgun, smtp, ses, sendgrid, etc.) accept only 'email'.
- If you need that channel, add a separate mailer entry of the right type (e.g. type 'twilio' with media ["sms"]) instead of overloading one adapter.
- Check spelling and case: valid values come from the adapter's getSupportedMessageTypes() (currently 'email' and 'sms'); review with 'bin/config get cluster.mailers'.
- After fixing, smoke-test the mailer with 'bin/mail send-test' to confirm it loads cleanly.
Example fix
// before (cluster/mailers.json): email-only adapter asked to do SMS
[{"key":"mailgun","type":"mailgun","media":["email","sms"],"options":{...}}]
// after: email-only mailer plus a dedicated SMS mailer
[{"key":"mailgun","type":"mailgun","media":["email"],"options":{...}},
{"key":"twilio","type":"twilio","media":["sms"],"options":{...}}] Defensive patterns
Strategy: validation
Validate before calling
// Before calling setMedia(), intersect with the adapter's native types.
$supported = array_fuse($adapter->getSupportedMessageTypes());
$wanted = array('email', 'sms');
$bad = array_diff($wanted, array_keys($supported));
if ($bad) {
throw new Exception('Media not supported by '.get_class($adapter).': '.implode(', ', $bad));
}
$adapter->setMedia($wanted); Prevention
- Keep each mailer's media list minimal; add a second mailer for a second channel instead of overloading one.
- Lint cluster.mailers in CI: every entry's media must be a subset of its adapter's getSupportedMessageTypes().
When it happens
Trigger: Loading cluster.mailers config where a mailer's 'media' entry lists a type its adapter does not support - e.g. a mailgun/SMTP/SES adapter (email only) configured with media ["email","sms"], a Twilio adapter configured with "email", or a typo like "Email". Any code path that calls PhabricatorMailAdapter::setMedia() with a bad list triggers it.
Common situations: Copy-pasting a multi-channel cluster.mailers JSON block onto an email-only adapter while enabling SMS notifications; enabling 'metamta.send-via-domain' style multi-media setups without an SMS-capable mailer; case or spelling mistakes in the media array.
Related errors
- Mailer ("%s") is attempting to access unknown option ("%s").
- Expected JSON response from Twilio.
- Configuration file is not properly formatted JSON. %s
- Configuration file has improper configuration keys at top le
- Two servers (at indexes "%s" and "%s") both bind to the same
AI-assisted analysis of phacility/phabricator@5720a38cfe (2026-08-21).
Data as JSON: /api/errors/2f3ed1fbf3541ae8.
Report an issue: GitHub.