Problem/Motivation
AI Media reads the default provider of each operation from ai.settings default_providers. When that provider's module is not installed (uninstalled later, or the config imported before the module), AiMediaGeneratorBase::defaultFor() still returns the default, so isConfigured() is TRUE: the editor is offered "Generate with AI", presses Generate, and gets "This could not be made. Try again." The paid-request line under the button shows the raw plugin id ("Each press is a paid request to openai.") because providerLabel() has no definition to read. The log carries PluginNotFoundException: The "openai" plugin does not exist.
Steps to reproduce
- Set
default_providers.text_to_imageto a provider whose module is not enabled (or uninstall the provider module after setting it). - As a content editor, open Add media > Image: the Upload / Generate with AI switch is offered.
- Describe an image and press Generate image: "This could not be made. Try again."
Proposed resolution
defaultFor() returns NULL when AiProviderPluginManager::hasDefinition() is FALSE for the configured provider id. The generator then counts as not set up: no switch for editors, and administrators read the "not set up" message naming the operation. Kernel test in ErrorMessagesTest.
Remaining tasks
- ✅ File an issue
- ❌ Addition/Change/Update/Fix
- ❌ Testing to ensure no regression
- ❌ Automated unit/functional testing coverage
- ➖ Developer Documentation support
- ➖ User Guide Documentation support
- ➖ UX/UI designer responsibilities
- ➖ Accessibility and Readability
- ❌ Reviewed by a human
- ❌ Code review by maintainers
- ❌ Full testing and approval
- ❌ Credit contributors
- ❌ Review with the product owner
- ✅ Update Release Notes
- ✅ Release
User interface changes
- With a default provider whose module is missing, the Generate switch is not offered and administrators see the "not set up" message instead of a failed generation.
Before: the editor is offered Generate with AI, presses Generate and gets "This could not be made. Try again."; the paid-request line names the raw plugin id.

After, as a content editor: the switch is not offered and the plain upload form shows.

After, as an administrator: the not set up message names the operation and links to the AI settings.

API changes
- N/A
Data model changes
- N/A
Release notes snippet
- A default provider whose module is not installed now counts as not set up instead of offering a Generate that fails.
AI-Generated: Yes
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | 3634660-after-admin-not-set-up.png | 88.18 KB | rajab natshah |
| #3 | 3634660-after-editor-upload-only.png | 64.92 KB | rajab natshah |
| #3 | 3634660-before-generate-fails.png | 81.67 KB | rajab natshah |
Issue fork ai_media-3634660
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
rajab natshahComment #5
rajab natshah✅ Released ai_media-1.0.0-rc1