Make WordPress Core

Opened 8 weeks ago

Last modified 3 weeks ago

#64917 new defect (bug)

WP 7.0 Connectors: unclear error message

Reported by: ecairol's profile ecairol Owned by:
Milestone: 7.0.1 Priority: normal
Severity: normal Version: trunk
Component: AI Keywords: ai-client has-patch has-screenshots
Focuses: ui-copy Cc:

Description

The error message for the lack of Connectors is too technical and does not provide a clear path for what the user should do.

After adding an Anthropic API Key from the Connectors page, I created a new Post and tried to generate an image. I got the error:

RequestAuthenticationInterface instance not set. Make sure you use the AiClient class for all requests.

The error is gone after adding an API key for OpenAI, which does support image generation.

However, it should be clear to the user what the problem is and what the next steps are.

Steps to Reproduce

  1. On WordPress 7.0, confirm you don't have a Connector for OpenAI (or any other image generation model)
  2. Create a New Post and insert an Image. Click on Generate Image

Expected result
An easy-to-understand error of what the problem is. Ideally with instructions to check the Connectors.

Actual result
The message: RequestAuthenticationInterface instance not set. Make sure you use the AiClient class for all requests.

Attachments (2)

Screenshot 2026-03-20 at 1.03.33 PM.png (168.7 KB) - added by ecairol 8 weeks ago.
generate-image-error-message-64917.jpg (242.2 KB) - added by ozgursar 4 weeks ago.
Generate Image error message

Download all attachments as: .zip

Change History (14)

#1 @JeffPaul
8 weeks ago

  • Keywords ai-client added

#2 @JeffPaul
8 weeks ago

  • Milestone changed from Awaiting Review to 7.0
  • Version set to trunk

This ticket was mentioned in Slack in #core by mukeshpanchal27. View the logs.


8 weeks ago

#4 @joedolson
8 weeks ago

  • Milestone changed from 7.0 to 7.0.1

#5 @JeffPaul
8 weeks ago

I concur that the error message there is not helpful and directive on how to resolve the issue. Perhaps something like:

This requires an AI provider that supports <capability-name>, but none are active. Please go to the Connectors settings page and enable an appropriate provider.

cc: @flixos90 @jason_the_adams for thoughts on error messaging and how best to handle within the AI client

#6 @JeffPaul
8 weeks ago

Note that there's a better error message that's thrown and highlighted in #64918:

No models found that support image_generation for this prompt.

But even that text doesn't really tell the user what to do to resolve the issue.

This ticket was mentioned in PR #11431 on WordPress/wordpress-develop by @gautam23.


6 weeks ago
#7

  • Keywords has-patch added

This pull request updates the error message thrown when request authentication is not set in the image generation client. The new message is more user-friendly and provides clear instructions for resolving the issue.

Trac ticket: https://core.trac.wordpress.org/ticket/64917

Error handling improvement:

  • Updated the exception message in WithRequestAuthenticationTrait.php to clearly inform users that image generation requires setup and instruct them to add an API key for an image-generation provider in Connectors.

#8 @dhruvang21
5 weeks ago

@JeffPaul The proposed message is definitely an improvement, but it may still be unclear for end users since <capability-name> exposes internal terminology and “none are active” can represent multiple states (no providers configured, providers disabled, or no providers supporting the capability).

It might be better to:

Use user-friendly capability labels (e.g., “image generation” instead of image_generation)

For example:

“No AI providers are configured. Please add one in Settings → Connectors.”
“Your active AI providers do not support image generation. Please enable a compatible provider.”

This would provide clearer, more actionable guidance and align with WordPress’ general approach to user-facing error messages.

#9 @JeffPaul
5 weeks ago

Yeah, user-friendly names would definitely be preferred @dhruvang21 if that's feasible to maintain.

#10 @gautam23
4 weeks ago

Hi guys,

My PR currently uses this text: "Image generation isn’t available because it hasn’t been set up yet. Please add an API key for an image-generation provider in Connectors, then try again."

Let me know if it needs to be updated to something else.

@ozgursar
4 weeks ago

Generate Image error message

#11 @ozgursar
4 weeks ago

  • Keywords has-screenshots added

Reproduction Report

Environment

  • WordPress: 7.1-alpha-62249
  • PHP: 8.3.30
  • Server: PHP.wasm
  • Database: WP_SQLite_Driver (Server: 8.0.38 / Client: 3.51.0)
  • Browser: Chrome 147.0.0.0
  • OS: macOS
  • Theme: Twenty Twenty-Five 1.4
  • MU Plugins: None activated
  • Plugins:
    • AI 0.7.0
    • Test Reports 1.2.1

Steps taken

  1. Settings > Connectors, click the Install the AI plugin button
  2. Settings > AI, toggle Enable AI then enable Image Generation and Editing
  3. Create a post and add an image
  4. Click Generate Image
  5. Type a prompt and click Generate
  6. Observe the message Image generation failed. Please ensure you have a connected provider that supports image generation.
  7. ❌ Bug is not occurring

Expected behavior

  • We expect to see a clear error message stating why Image Generation is not available.

Additional Notes

  • This could have been fixed with another ticket.

Screenshots/Screencast with results

https://core.trac.wordpress.org/raw-attachment/ticket/64917/generate-image-error-message-64917.jpg

#12 @JeffPaul
3 weeks ago

@jorgefilipecosta @gziolo this looks ready for your review, potential commit

Note: See TracTickets for help on using tickets.