Halfway through an AI build, everything starts failing with rest_not_logged_in. The password has not changed. Your site has locked the assistant out.
Why it happens
AI tools make many API requests quickly. If a few fail (a wrong username, a revoked password, a header the server strips), a security plugin, LiteSpeed or the host’s firewall sees a burst of failed logins from one address and blocks it. While the block lasts, even correct credentials fail.
How to recover
- Stop the tool. Retries usually extend the block.
- Wait out the cool-down, or clear the lockout in your security plugin or with your host.
- Test once with a single request to
/wp-json/wp/v2/users/me.
How to prevent it
- Allowlist the AI tool’s IP address for
/wp-json/in your security plugin or with your host. - Get the credentials right before building: the username is filled in, the password is copied once, and the Authorization header reaches PHP.
- Make tools stop on authentication errors instead of retrying. On this site, every build run starts with one login test and stops at once if the site refuses.
- Use one dedicated user for the AI, so its activity is easy to spot in logs.
Related: how to fix rest_not_logged_in.


