Yoast SEO 开发者文档

title: "Ai Errors" post_status: publish comment_status: open taxonomy: category: - yoast-developer post_tag: - Ai - Features - Repos


import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem';

This documentation provides information about the errors displayed by the Yoast AI features. All Yoast AI features connect to the Yoast AI API, which in turn connects to an AI service provider (currently: OpenAI). Below, we list the possible error messages based on the HTTP response status codes received from this API.

400 responses

This section lists the errors that are displayed for 400 Bad Request responses.

"Unethical request" error

The Yoast AI features rely on the Azure OpenAI content filtering system, which has a policy against unethical content. The system flags input that includes hate, violence, self-harm references or sexual content.

This error message is displayed when your content does not pass the content filter system.

:::note[Error message] Usage policy violation
Due to OpenAI's strict ethical guidelines and usage policies, we cannot generate suggestions for the content on this page. If you intend to use AI, kindly avoid the use of explicit, violent, copyrighted, or sexually explicit content. In case you need further help, please contact our support team.
Error example The message includes links to: the OpenAI usage policies and the Yoast Support page (for WordPress sites it's the one within the Yoast SEO plugin's Settings; for Shopify sites -- the one on yoast.com).
:::

"Not enough content" error

The use of Yoast AI requires enough content in order to generate valuable AI suggestions. This error message is displayed when there is not enough content on the page.

:::note[Error message] Not enough content
Please add more content to ensure a valuable AI suggestion. Learn more on our page about common AI feature problems and errors. In case you need further help, please contact our support team.
Error example The message includes links to: an article on common AI feature problems and errors and the Yoast Support page (for WordPress sites it's the one within the Yoast SEO plugin's Settings; for Shopify sites -- the one on yoast.com).
:::

"Site unreachable" error

The use of Yoast AI requires your site to be publicly accessible. This error message is displayed when that is not the case.

:::note[Error message] Yoast AI cannot reach your site
To use this feature, your site must be publicly accessible. This applies to both test sites and instances where your REST API is password-protected. Please ensure your site is accessible to the public and try again. Learn more on our page about common AI feature problems and errors. In case you need further help, please contact our support team.
Error example The message includes links to: an article on common AI feature problems and errors and the Yoast Support page (for WordPress sites it's the one within the Yoast SEO plugin's Settings; for Shopify sites -- the one on yoast.com).
:::

"Bad WordPress request" error

In the Yoast SEO plugins for WordPress, we use the WordPress REST interface to connect to our Yoast AI API. This error message is displayed if something went wrong in that connection.

:::note[Error message] Something went wrong
The request came back with the following error: 'test'. Please try again later. If the issue persists, please contact our support team.
Error example The message includes a link to the Yoast Support page (for WordPress sites it's the one within the Yoast SEO plugin's Settings; for Shopify sites -- the one on yoast.com).
:::

402 responses

This section lists the errors that are displayed for 402 Payment Required responses.

Subscription error

The use of Yoast AI requires an active subscription for your site. Please refer to this page to understand the subscriptions required to use the Yoast AI features.

This error message is displayed when you do not have the required active subscriptions. The error message and links are adapted depending on the missing subscription(s).

:::note[Error message] Subscription required
For one subscription
To access this feature, you need an active Yoast SEO Premium subscription. Please activate your subscription in MyYoast or get a new Yoast SEO Premium subscription. Afterward, refresh this page. It may take up to 30 seconds for the feature to function correctly.
For two subscriptions
To access this feature, you need active Yoast SEO Premium and Yoast WooCommerce SEO subscriptions. Please activate your subscriptions in MyYoast or get a new Yoast WooCommerce SEO Premium bundle. Afterward, refresh this page. It may take up to 30 seconds for the feature to function correctly.
Error exampleError example Depending on the missing subscription(s), the message includes links to: an article on how to activate a Yoast subscription as well as pages on upgrading to Yoast SEO Premium, to Yoast WooCommerce SEO, and to the Yoast WooCommerce Premium bundle.
:::

408 responses

This section lists the errors that are displayed for 408 Request Timeout responses.

"Request timeout" error

The Yoast AI features expect a response from the Yoast AI API within 60 seconds. This error message is displayed when the response is not retrieved within 60 seconds.

:::note[Error message] Connection timeout
It seems that a connection timeout has occurred. Please check your internet connection and try again later. Learn more on our page about common AI feature problems and errors. In case you need further help, please contact our support team.
Error example The message includes links to: an article on common AI feature problems and errors and the Yoast Support page (for WordPress sites it's the one within the Yoast SEO plugin's Settings; for Shopify sites -- the one on yoast.com).
:::

429 responses

This section lists the errors that are displayed for 429 Too Many Requests responses.

Rate limit error

The use of Yoast AI comes with rate limits to ensure fair use. Moreover, we are in the process of introducing a subscription-based limit on the amount of AI generations per month. Please refer to this page to understand the rate limits that are applicable.

This error message is displayed when you surpass your Yoast AI sparks limit or one of the Yoast AI rate limits.

:::note[Error message] You've reached the Yoast AI rate limit
You might have reached your Yoast AI rate limit for a specific time frame or your sparks limit for this month. If you have reached your rate limit, please reduce the frequency of your requests to continue using Yoast AI features. Our help article provides guidance on effectively planning and pacing your requests for an optimized workflow.
Error example The message includes a link to an article on the rate limits for the AI features in Yoast SEO Premium.
:::

Generic error

For all other error responses, the Generic error is displayed. This includes the following cases: when we are not able to further refine the 400 error response; 403 Forbidden and 503 Service Unavailable responses; other error responses (i.e., which are not 200 OK).

:::note[Error message] Something went wrong
Please try again later. If this issue persists, you can learn more about possible reasons for this error on our page about common AI feature problems and errors. In case you need further help, please contact our support team.>
Error example The message includes links to: an article on common AI feature problems and errors and the Yoast Support page (for WordPress sites it's the one within the Yoast SEO plugin's Settings; for Shopify sites -- the one on yoast.com).
:::

Other errors

This section lists other errors that can be displayed during the use of Yoast AI features, unconnected to the Yoast AI API.

"SEO analysis required" error

Our Yoast AI features require the SEO analysis to be enabled in the settings. When a user tries to make use of the AI features without having the SEO analysis enabled, this error message is displayed.

:::note[Error message] SEO analysis required
Yoast AI requires the SEO analysis to be enabled. To enable it, please navigate to Site features in Yoast SEO, turn on the SEO analysis, and click 'Save changes'. If it's disabled in your WordPress user profile, access your profile and enable it there. Please contact your administrator if you don't have access to these settings.
Error example The message includes a link to the Site features admin page within the Yoast SEO plugin's Settings.
:::

模拟这些错误

在 WordPress 中

如果你需要在不实际触发这些错误的情况下显示它们(例如,在不实际达到速率限制的情况下显示速率限制错误),可以通过编辑 Yoast SEO 仓库src/ai-generator/user-interface/get-suggestions-route.php 文件里的 get_suggestions 函数来实现。 为此,请将 try 代码块的内容替换为下面的一个错误。同时,将后续 catch 代码块中的变量替换为错误名称(例如 Bad_Request_Exception),并将该错误添加到导入语句中(例如 use Yoast\WP\SEO\AI_HTTP_Request\Domain\Exceptions\Bad_Request_Exception;)。

从以下错误中选择一个:

```php
throw new Bad_Request_Exception( "test", 400, "AI_CONTENT_FILTER" );     // 不道德的请求错误
throw new Bad_Request_Exception( "test", 400, "NOT_ENOUGH_CONTENT" );    // 内容不足错误
throw new Bad_Request_Exception( "test", 400, "WP_HTTP_REQUEST_ERROR" ); // WordPress 请求错误
throw new Bad_Request_Exception( "test", 400, "SITE_UNREACHABLE" );      // 站点无法访问错误
throw new Bad_Request_Exception( "test", 400, "other" );                 // 通用错误
throw new Payment_Required_Exception( "test", 402, "test", null, ['Yoast SEO Premium'] ); // 订阅错误,将数组替换为缺失的许可证
throw new Request_Timeout_Exception( "test", 408, "test" );              // 请求超时错误
throw new Too_Many_Requests_Exception( "test", 429, "test" );            // 速率限制错误