WiozenAPI

Why does my AI article bot stop halfway in WordPress? "Run is stuck" and LiteSpeed

In short: Usually the server kills a long PHP request before the work is done. On shared hosting a single request is typically cut at around two minutes, and LiteSpeed can end a request as soon as its connection closes. Wiozen Content Bot therefore builds each article across separate requests, resumes a cut-off article from the step where it stopped on the next run, and after 8 minutes without progress shows a "The run is stuck" notice with a Remove lock button. On LiteSpeed servers, adding the .htaccess rule the dashboard suggests reduces the cut-offs.

Why does a run get cut off?

Producing one article takes minutes: a web search, the writing, an editor pass, an image. Each of those calls waits for the API's answer. While it waits, a WordPress plugin is running inside a PHP request, and it's the server, not the plugin, that decides how long a PHP request may live.

Two causes are common. One is the host's time limit: most shared plans kill a single request at around two minutes. The other is LiteSpeed: according to its documentation, the server kills the process of a PHP request whose connection has closed. WP-Cron, WordPress's scheduler, closes the connection of its own request right after starting it, so a long background job on LiteSpeed can be cut in the middle. When the process dies, PHP gets no chance to log an error; in older versions that's why the log stayed empty while the dashboard kept saying a run was in progress.

How does the bot split a run into chunks?

Since version 1.5.0 the Content Bot doesn't process a run in one request but in chunks. Each chunk does one job: it either picks topics for a category or moves one article to its next stage. An article has three stages: research and writing, the editor pass, and saving plus the image.

The wait on each API call is kept under the limit: 115 seconds for writing, 90 for the editor, 80 for topic selection, 90 for the image and 30 for the web search. When time runs out the bot stops waiting and records the error itself, before the server gets to kill the process.

When a chunk finishes, the bot starts the next one with a background request to the site's own admin-ajax.php. If that request doesn't get through, the same job also waits as a WP-Cron event and continues with the next visit to the site. Each chunk holds a lock while it runs, so two chunks never run at once and a scheduled run doesn't pile on top of one in progress (the log says "The previous run is still in progress; this run was skipped.").

What does "The run is stuck" mean, and what does "Remove lock" do?

While a run is going, the Overview tab refreshes every 4 seconds and shows the category, the article number and the current step. If 8 minutes have passed since the last progress, or the process handling a chunk vanished without releasing its lock, the dashboard treats the run as stuck and says so: "The run is stuck", with the step and how many minutes it has made no progress.

Remove lock closes the run, writes the cut-off to the Log tab and releases the lock. You don't have to press it, though: once the run shows as stuck, Run now becomes available again and a new run clears the stale lock by itself. Even if nobody opens the dashboard, every chunk schedules a watchdog event about 9 minutes ahead; when it fires, the cut-off is recorded and the run closes with "The last run stopped unexpectedly".

The log line names the step: [Category] The previous run was cut off at the "Writing" step (possibly a server time limit). If it's always the same step, that step's duration is the likely cause.

What happens to the half-written article?

It isn't thrown away. If it hasn't been saved yet, it's kept along with the stage it reached and becomes the first job of the next run; the log says the article cut off in the previous run is being resumed. That record is valid for 2 days. If no category is active at that point, the record isn't deleted; it waits until one is turned on.

A slow editor is a separate case. If the editor doesn't answer within 90 seconds, the run carries on: the article is saved as first written and the log says "Editor review could not be applied ... The article was saved as originally written." How the image queue works is in the featured image guide.

What should I do on a LiteSpeed server?

When the bot detects LiteSpeed, the Overview tab shows a notice titled "Your server runs LiteSpeed". Add the lines from that notice to the very top of the .htaccess file in your site's root folder:

.htaccess
<IfModule Litespeed>
RewriteEngine On
RewriteRule wp-cron\.php - [E=noabort:1,E=noconntimeout:1]
RewriteCond %{QUERY_STRING} action=wcb_continue
RewriteRule admin-ajax\.php - [E=noabort:1,E=noconntimeout:1]
</IfModule>

The rules only touch two requests: WP-Cron and the bot's own background request. The site-wide .* version was left out on purpose; LiteSpeed's documentation advises against it because on some shared servers it can lock up the whole site. Once the bot sees the rule working on its own background request, the notice goes away. If it doesn't, ask your host whether the noabort environment variable is read from .htaccess.

What to check if cut-offs keep happening

The rest of the setup, and how WP-Cron depends on visits, is in the auto-publishing guide.

Frequently asked questions

Is the article lost when a run is cut off?

No. An unsaved article is kept for 2 days with the stage it reached and becomes the first job of the next run. A saved article that's missing its image goes to the image queue.

When does "The run is stuck" appear?

When 8 minutes have passed since the last progress, or when the process handling a chunk disappeared without releasing its lock. The dashboard shows which step it stopped at.

Can pressing "Remove lock" break anything?

No. It closes the run, logs the cut-off and leaves the half-written article for the next run. A new "Run now" run does the same thing on its own.

Does the LiteSpeed rule affect the whole site?

No. It only applies to wp-cron.php and the bot's own admin-ajax request. The rest of the site works as before.

If the editor doesn't answer in time, is the article still saved?

Yes, as a draft or published according to the category setting. If the editor doesn't return within 90 seconds, the article is saved as first written and the run continues.

If you're on an older version, update to 1.5.11 from the WordPress updates screen or download it from the product page. Chunked runs and the stuck indicator arrived in 1.5.0, resuming a half-written article in 1.5.8.

Create your account

More guides: How can you use an AI API from Turkey without a credit card? · How do you connect an OpenAI-compatible API to a tool you already use? · How do you calculate the cost of an AI API? · What should I do if my AI API key has leaked? · How do you generate images with an AI API, and what does one image cost? · Why does my AI API return a 429 error, and how do I fix it? · Why do long AI API requests time out: streaming or non-streaming? · Anthropic Messages API or OpenAI Chat Completions: which one should I use? · What is a context window, and what is a 1 million token context good for? · Which AI model should I choose: deciding by price, context and quality · Why does a reasoning model return an empty answer, and why are thinking tokens charged? · Why is my API balance running out faster than expected? Tracking spend request by request · How do you convert a web page to Markdown to feed it to an AI model? · How do you get AI to write and publish articles in WordPress automatically? · How do you find blog topics from RSS feeds and Google Trends? · Does AI-written content show up on Google and in AI answers? · How do you get internal links into AI-written WordPress articles? · How do you get AI to generate a different featured image for every WordPress post? · How do you write a content brief when an AI writes your blog posts? · What should you watch for when an AI writes recipes for your food blog? · How do you fix errors when connecting a WordPress plugin to your AI API account? · Why are my scheduled WordPress posts late? WP-Cron and a real server cron · How do I get an AI article bot to write blog posts in English or another language? · What does "Content Bot cannot generate articles" mean? Reading the bot's log