没有不值得去解决的问题,也没有不值得去学习的技术!

GLM-5.2 Returns 400 for Full-Text Translation: A Step-by-Step Record of Locating and Resolving a Content Security Misblock

Figure 1: Historical article batch processing returns HTTP 400, indicating the content safety check failed.

作者:

在

Recently, while continuing to process English override translations for historical Chinese articles, I encountered another article that could not be translated successfully.

This time, the issue was different from the usual Protected Token validation failures, network request exceptions, or WordPress write failures. The translation API directly returned an HTTP 400 with a clear message:

The system detected that the input or generated content may contain unsafe or sensitive content; please avoid entering prompts that easily generate sensitive content.

The article itself is an ordinary technical blog post recording SEO practices, primarily discussing English site indexing, tag pages, and Search Console data, without deliberately touching upon sensitive topics.

Therefore, this issue seemed more like a false positive triggered by the content safety system in a specific context.

Interestingly, the content I initially suspected remained problematic even after two rounds of modifications. What ultimately restored the translation was a different set of seemingly more ordinary traffic statistics expressions.

This article documents the complete troubleshooting process.


1. Historical article batch processing fails on the 9th article

This time, I was continuing the historical article migration within the wordpress-ai-excerpt-backfill project.

The batch stopped at the 9th article:

  • Chinese article ID: 15738
  • English article ID: 15775
  • Attempts: 3
  • Final status: translation_failed

The error was not a structural validation failure after translation, but a direct return when calling the translation API:

Plaintext
HTTP request failed with status 400:
prompt_client_error: Bad Request (400)

The subsequent message further explained that the server believed the input or generated content might have triggered a content safety check.

Figure 1: Historical article batch processing returns HTTP 400, indicating the content safety check failed.
Figure 1: Historical article batch processing returns HTTP 400, indicating the content safety check failed.

This is clearly different from a standard HTTP 500, timeout, or WordPress REST API write exception.

The request did not even reach the subsequent candidate content validation stage, so I first needed to examine the original Chinese article itself.


2. First reaction: suspecting a network access-related term

The article primarily discusses multilingual website SEO.

Most of the content is quite ordinary:

  • Number of Chinese and English articles;
  • Number of categories and tags;
  • Google Search Console;
  • noindex, follow;
  • Crawl Budget;
  • Overseas traffic to the English site;
  • Technical content like Linux, Go, Gin, Docker.

After checking paragraph by paragraph, I first noticed a network access-related technical term in Section 5.

Figure 2: A network access-related technical term in the body text that was initially suspected.
Figure 2: A network access-related technical term in the body text that was initially suspected.

Previously, when processing another historical article, I encountered a similar situation.

At that time, a network access-related expression caused the translation API to reject the request. After rewriting it to the more neutral term “network service,” the article could be processed.

Therefore, my initial suspicion naturally fell in the same direction this time.

But there is a principle here:

Do not directly delete information originally present in the source text just to pass the translation API.

So, instead of deleting it the first time, I changed the original abbreviation to its corresponding full Chinese technical name.


3. Changed to the full Chinese name, still failed

After the first modification, I checked using the recovery tool:

Bash
python3 bin/history-migration.py recover \
    --post-id 15738

The program correctly identified that the production Chinese article had changed:

Plaintext
Production Chinese source: Modified
Recovery strategy: restart_from_current
Will execute: restart_from_current -> execute_single_candidate
Reason: production Chinese title or content changed after pre-write

This is exactly the recovery path needed.

Because the Chinese source had been manually modified, I could not continue to directly resume using the old failure scene. Instead, I needed to:

  1. Re-establish the baseline using the current production Chinese content;
  2. Re-execute the single-article English override translation.

Then I executed:

Bash
python3 bin/history-migration.py recover \
    --post-id 15738 \
    --execute

The result, however, was still the same HTTP 400.

This showed that simply changing the English abbreviation to an accurate Chinese name did not solve the problem.

Figure 3: The body text after changing the initially suspected network access term to its full Chinese name.
Figure 3: The body text after changing the initially suspected network access term to its full Chinese name.

This result began to weaken my initial judgment.

If the safety system was simply matching a fixed English abbreviation, theoretically it should have changed after switching to Chinese.

So, I proceeded with a second test.


4. Further changed to “network service”, still failed

The second time, I no longer kept the specific technical name, but adopted the neutral expression previously used in historical articles:

Network service

Then executed again:

Bash
python3 bin/history-migration.py recover \
    --post-id 15738

Confirmed the recovery strategy was still:

Plaintext
restart_from_current

Then executed:

Bash
python3 bin/history-migration.py recover \
    --post-id 15738 \
    --execute

The result still did not change:

Plaintext
HTTP request failed with status 400:
prompt_client_error

At this point, I could basically stop troubleshooting around this network term.

The troubleshooting chain had become:

Plaintext
Original technical term
↓
Full Chinese name
↓
More neutral "network service"
↓
All three expressions returned the same HTTP 400

Therefore, the initial assumption that “the network access-related term was the trigger” did not hold.

At least, it was not the only trigger factor for this article in its current state.


5. Second direction: country and region traffic statistics

After re-reading the entire article, another concentrated section was the overseas traffic statistics.

The article listed specific countries and regions multiple times, and also included:

  • Percentages;
  • Overseas traffic;
  • Countries;
  • Regions;
  • Search Console data.

Among them was a fairly complete set of country and region traffic ratios, and the same content also appeared in the screenshot’s image alt attribute.

To continue narrowing down the scope, I first rewrote this specific set of data into a more generalized expression:

Overseas traffic from multiple countries and regions has increased

The image’s alt was also updated accordingly.

Figure 4: Adjusting specific country and region traffic statistics to generalized expressions, and updating the image ALT accordingly.
Figure 4: Adjusting specific country and region traffic statistics to generalized expressions, and updating the image ALT accordingly.

There is an easily overlooked detail here:

WordPress image ALT text is also part of the article’s HTML content.

If the translation plugin sends the Gutenberg HTML as a whole to the model, then even if the body text has been modified, as long as the alt still retains the original text, the same content could still appear in the request.

However, after re-executing it this time, the HTTP 400 still persisted.

This indicated that this complete statistic was also not the only trigger condition.


6. Stop guessing single words, process remaining similar expressions instead

Checking the modified article revealed that although the main statistics paragraph had been changed, several specific country and region names still existed in the body text, for example:

  • Traffic ratios for two specific countries;
  • Descriptions tracking actual traffic from different countries;
  • Descriptions of overseas traffic sources in the summary section.

Therefore, the previous experiment actually only proved:

The modified statistical sentence was not the only trigger location.

It did not prove that the entire “country and region traffic expression” direction was problem-free.

So, in the next round, instead of guessing specific words one by one, I uniformly changed the remaining similar expressions to more generalized descriptions.

For example:

English articles and English categories have started bringing in more overseas traffic.

And:

Tracking actual traffic conditions across different countries and regions.

The summary section was changed to:

Successfully brought in more overseas traffic.

These adjustments did not change the article’s original conclusions; they simply stopped specifying non-core information down to every single country or region name.


7. Recovery again, this time finally successful

After saving the modified production Chinese article, I first executed a preview:

Bash
python3 bin/history-migration.py recover \
    --post-id 15738

The program determined again:

Plaintext
Production Chinese source: Modified
Recovery strategy: restart_from_current

Then formally executed:

Bash
python3 bin/history-migration.py recover \
    --post-id 15738 \
    --execute

This time, the result finally changed to:

Plaintext
Baseline rebuild: completed
Re-execution: completed
Final status: completed
Next step: none
Figure 5: After adjusting the remaining country and region traffic expressions, the baseline was rebuilt and the English override translation was successfully completed.
Figure 5: After adjusting the remaining country and region traffic expressions, the baseline was rebuilt and the English override translation was successfully completed.

With this, the historical English re-translation for Chinese article ID 15738 was completed.


8. This cannot be simply summarized as “a certain word is sensitive”

This troubleshooting process easily leads to an incorrect conclusion.

Initially seeing a certain network access technical term in the article, it is easy to assume:

This specific word caused the HTTP 400.

But actual verification does not support this claim.

After two consecutive rounds of modifications:

  • Changing to the full Chinese technical name failed;
  • Changing again to the neutral “network service” still failed.

What actually made a difference was later unifying and generalizing multiple specific country and region traffic expressions, after which the request returned to normal.

But even so, I think we still cannot further assert:

A specific country or region name is a sensitive word.

Because the final modification actually changed multiple pieces of similar content.

What we can confirm is:

In the context of this article, this request, and the current model service environment, a set of specific country and region names combined with traffic statistics context likely contributed to triggering the content safety check; after changing this content to more generalized expressions, the request returned to normal.

As to whether it was a single word, a combination of words, or the context formed after the model generated the English text that triggered the check, there is no need to continue testing repeatedly just to find the sole trigger point.


9. The “input or generated content” in the error message is also worth noting

There is another important detail in this error message:

The system detected that the input or generated content may contain unsafe or sensitive content.

This means we cannot simply assume that all HTTP 400 errors are immediate keyword matches made after submitting the Chinese source text.

At least based on the error message itself, there is another possibility:

  1. The Chinese content first passes a partial check;
  2. The model starts generating English text;
  3. Certain expressions in the generated result trigger the safety check;
  4. The entire request ultimately still returns an HTTP 400.

Therefore, based on a single failure, it is difficult to accurately determine exactly which Chinese word caused the problem.

This is also why such issues are better verified through actual modifications and resubmissions, rather than relying solely on guessing.


10. When processing historical articles, I prefer “equivalent rewriting” over deletion

There is also a rather important processing principle this time.

Historical articles have been publicly available for years, and many terms in the original text were part of the real technical context at the time.

If we simply delete content because the current model API cannot accept it, it easily causes two problems:

  1. The original information is altered;
  2. Semantic differences start to appear between the English version and the Chinese version.

Therefore, I now prefer:

Performing equivalent or generalized rewrites on non-core, high-risk expressions, provided it does not affect the article’s core technical meaning.

For example, specific country traffic ratios are not core technical information for an article discussing SEO strategy.

What the article really needs to express is:

The English content has started receiving overseas visits.

So, adjusting from specific percentages to “overseas traffic from multiple countries and regions has increased” does not undermine the article’s main conclusion.

This approach is more reliable than directly deleting entire paragraphs.


11. Screenshots can preserve troubleshooting evidence, but ALT text need not repeat specific content

While organizing these troubleshooting records, I also decided to adopt a slightly different writing approach.

The body text will not repeatedly list all the specific suspected words, but will use:

  • Network access-related technical terms;
  • Network service-type expressions;
  • Specific country and region names;
  • Regional traffic statistics;
  • Neutral, generalized expressions.

The actual original scene is preserved in the screenshots.

This both preserves the troubleshooting evidence and avoids copying a large number of similar expressions into the new article’s body text just to document a content safety issue.

At the same time, there is no need for the screenshot’s ALT text and caption to restate all the text in the screenshot.

For example:

Historical article translation returns HTTP 400 content safety error

is sufficient to explain the image’s purpose.

There is no need to write the original expressions from the screenshot into the ALT text in full again.


12. A new optimization direction for the recovery tool itself

Based on this status change, the existing recover process performed correctly.

After manually modifying the production Chinese article:

Plaintext
Production Chinese source: Modified
Recovery strategy: restart_from_current

The tool does not continue using the old baseline to force a recovery, but rather:

Plaintext
restart_from_current
↓
Re-establish baseline
↓
execute_single_candidate

This prevents mixing evidence from before and after the modification.

However, this time it also exposed a direction for future optimization.

Currently, this type of error ultimately displays as:

Plaintext
Actual error: wordpress_api_error

But the key cause in the actual exception is already very clear:

Plaintext
prompt_client_error
HTTP 400

If similar articles are encountered again in the future, we can consider further classifying this error independently.

For example, distinguishing between:

  • Standard WordPress API exceptions;
  • Network exceptions;
  • Content safety-related HTTP 400 errors;
  • Protected Token validation failures;
  • English write exceptions.

This way, upon seeing a batch failure, it becomes faster to determine:

Whether this article should be checked for translation structure, or whether the original content should be checked directly.

However, the historical article migration is still ongoing, so there is no immediate need to modify the program for just a single article.


13. Summary

This historical article translation failure ultimately went through a rather typical process of misjudgment and gradual elimination:

  1. The translation API returned an HTTP 400 content safety error;
  2. First suspected a network access-related technical term;
  3. Changed to the full Chinese name, still failed;
  4. Changed again to a more neutral network service expression, still failed;
  5. Pivoted to checking specific country and region traffic statistics;
  6. Modified one set of statistics, still failed;
  7. Continued to uniformly generalize the remaining similar expressions;
  8. Re-established the current Chinese source baseline;
  9. Re-executed the English override translation;
  10. Final status restored to completed.

The biggest takeaway this time is not finding a so-called “sensitive word list”, but rather:

Content safety errors are not necessarily triggered by an isolated keyword; they may also be related to the entire paragraph’s context, a combination of multiple words, or even the model’s generated results.

Therefore, when encountering a similar HTTP 400, rather than continuously guessing a single word, it is better to gradually narrow down the scope by semantic category.

At the same time, we should not directly delete historical article content just to let the model pass the check.

For information that is not core to the article, adopting more neutral, generalized expressions that preserve the original meaning is usually a more reliable approach.

For the original scenes that truly hold technical record value, they can be preserved via screenshots.

This allows historical articles to continue their English migration while preserving the integrity and readability of the original content as much as possible.

关于作者 · 持续学习与技术实践

我是一名拥有 15 年以上开发经验的技术从业者,自 2013 年起持续运营个人技术博客,记录工作与个人项目中遇到的真实问题,以及解决问题过程中的探索、实践和思考。

除了技术写作,我也在持续开发和维护自己的独立项目,探索新技术和新工具在实际场景中的应用。我始终相信,没有不值得去解决的问题,也没有不值得去学习的技术。

如果这篇文章对你有所帮助,欢迎浏览博客中的其他文章,也欢迎交流技术经验与想法。

关于我  ·  GitHub  ·  邮件联系