-
Notifications
You must be signed in to change notification settings - Fork 0
Could Not Generate a Question
This is the widget's fallback message. The JavaScript shows it when the request failed and the server did not supply a more specific message it could display.
Because it is a catch-all, the useful diagnostic step is to find out what the server actually said.
Open your browser's developer tools, go to the Network tab, and reload the page. Look for the request to:
/wp-json/ai-fun-questions/v1/question
Click it and read the response. It will contain a code and a message far more specific than the fallback. Common ones:
| Code | Meaning |
|---|---|
ai_fq_openai_config, ai_fq_ollama_config, ai_fq_hf_config
|
Settings incomplete for the selected provider |
ai_fq_provider_error |
The call was attempted and failed |
ai_fq_invalid_json |
The model's reply was not usable JSON |
ai_fq_missing_field |
A required field was missing from the reply |
ai_fq_invalid_content |
The reply was too long or empty once sanitised |
ai_fq_rate_limited |
Rate limited — see the dedicated page |
ai_fq_invalid_widget |
The request had no valid widget token |
Look each up in Error Messages Reference.
If there is no request to that endpoint at all, the problem is on the page, not the provider:
- The widget's JavaScript did not load. Check the Console tab for errors. An optimisation or minification plugin that defers, combines or rewrites scripts is the usual culprit — exclude the plugin's script and retest.
-
The REST API is blocked. Some security plugins and hosts restrict
/wp-json/. The plugin's two endpoints are intentionally public, because the widget must work for logged-out visitors. If your security plugin blocks anonymous REST access, allow these two routes. -
The shortcode did not render. If you see the literal text
[ai_fun_question]on the page, you have put it in a Custom HTML block, which does not run shortcodes. Use a Shortcode block.
Settings incomplete. The most frequent cause by far. Remember that only the selected provider's panel matters — a fully-filled Hugging Face panel does nothing if OpenAI-compatible is selected.
The server cannot reach the provider. The AI call is made from your server, not the visitor's browser. A host that blocks outbound HTTP, or a firewall in the way, produces this even though the credentials are perfect. Test from the server, not your laptop.
Bad credentials or no credit. An expired key, a revoked token, or an account out of credit all surface as ai_fq_provider_error, because the plugin will not show you the provider's own error text.
The model is not suitable. A model that cannot reliably return JSON produces ai_fq_invalid_json or ai_fq_missing_field, often intermittently — some questions work, some do not. Try a larger instruction-tuned model.
Ollama unreachable from PHP. A classic: Ollama answers fine in your terminal but PHP-FPM runs as another user or in a container with a different network view. Test from the web server's perspective.
If the network response is ai_fq_provider_error and you still cannot tell why, the upstream error is written to the PHP error log when WP_DEBUG is enabled.
Do this on staging, not production. The plugin deliberately keeps upstream errors away from visitors, and debug logging is a separate path that can capture request detail.
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );Reproduce the failure, read wp-content/debug.log, then turn it off again.
- Reinstalling the plugin. This message is nearly always configuration or connectivity.
- Clearing your cache. The widget fetches at runtime; cached HTML is not the issue.
- Switching provider blindly. Find the real error first — you will usually hit the same wall.
Getting started
- Home
- What AI Fun Questions Does
- Installing the Plugin
- The Settings Screen
- Adding the Widget to Your Site
Provider setup
Running it
- Keeping API Keys Out of the Database
- Rate Limits Explained
- Running Behind Cloudflare or a CDN
- What It Costs to Run
Troubleshooting
- Error Messages Reference
- Please Wait Before Requesting Another Question
- Could Not Generate a Question
Privacy and security
Extending