{"record":{"id":"2f3ed1fbf3541ae8","repo":"phacility/phabricator","slug":"adapter-s-is-configured-for-medium-s-but","errorCode":null,"errorMessage":"Adapter (\"%s\") is configured for medium \"%s\", but this is not a supported delivery medium. Supported media are: %s.","messagePattern":"Adapter \\(\"(.+?)\"\\) is configured for medium \"(.+?)\", but this is not a supported delivery medium\\. Supported media are: (.+?)\\.","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"src/applications/metamta/adapter/PhabricatorMailAdapter.php","lineNumber":64,"sourceCode":"        $config_map = $this->media;\n        $config_map = array_fuse($config_map);\n\n        $media_map = array_intersect_key($media_map, $config_map);\n      }\n\n      $this->mediaMap = $media_map;\n    }\n\n    return isset($this->mediaMap[$message_type]);\n  }\n\n  final public function setMedia(array $media) {\n    $native_map = $this->getSupportedMessageTypes();\n    $native_map = array_fuse($native_map);\n\n    foreach ($media as $medium) {\n      if (!isset($native_map[$medium])) {\n        throw new Exception(\n          pht(\n            'Adapter (\"%s\") is configured for medium \"%s\", but this is not '.\n            'a supported delivery medium. Supported media are: %s.',\n            get_class($this),\n            $medium,\n            implode(', ', $native_map)));\n      }\n    }\n\n    $this->media = $media;\n    $this->mediaMap = null;\n    return $this;\n  }\n\n  final public function getMedia() {\n    return $this->media;\n  }\n","sourceCodeStart":46,"sourceCodeEnd":82,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/metamta/adapter/PhabricatorMailAdapter.php#L46-L82","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before (cluster/mailers.json): email-only adapter asked to do SMS\n[{\"key\":\"mailgun\",\"type\":\"mailgun\",\"media\":[\"email\",\"sms\"],\"options\":{...}}]\n\n// after: email-only mailer plus a dedicated SMS mailer\n[{\"key\":\"mailgun\",\"type\":\"mailgun\",\"media\":[\"email\"],\"options\":{...}},\n {\"key\":\"twilio\",\"type\":\"twilio\",\"media\":[\"sms\"],\"options\":{...}}]","handlingStrategy":"validation","validationCode":"// Before calling setMedia(), intersect with the adapter's native types.\n$supported = array_fuse($adapter->getSupportedMessageTypes());\n$wanted = array('email', 'sms');\n$bad = array_diff($wanted, array_keys($supported));\nif ($bad) {\n  throw new Exception('Media not supported by '.get_class($adapter).': '.implode(', ', $bad));\n}\n$adapter->setMedia($wanted);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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()."],"tags":["phabricator","metamta","mailer","configuration","sms","message-type"],"backgroundTag":"unsupported-message-type","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}