HTML Guides for 202
Learn how to identify and fix common HTML validation errors flagged by the W3C Validator — so your pages are standards-compliant and render correctly across every browser. Also check our Accessibility Guides.
An HTTP 202 Accepted status code indicates that the server has received and acknowledged the request, but the processing is not yet complete. This is commonly used for asynchronous operations — the server queues the work and responds immediately to let the client know the request was accepted without making the client wait. While this is perfectly valid for APIs and background job systems, it’s not appropriate for serving HTML documents, stylesheets, scripts, or other resources that the browser (or validator) needs to read immediately.
The W3C HTML Validator works by fetching your page and any linked resources (CSS files, images, scripts, etc.) over HTTP. It expects a 200 OK response with the full content in the response body. When it receives a 202 Accepted, the body may be empty, incomplete, or contain a placeholder — none of which can be meaningfully validated. This results in the validator aborting its check for that resource and reporting the error.
Common Causes
- Server-side processing delays: Your web server or application framework is deferring content generation to a background process and returning 202 as an interim response.
- Asynchronous or queued endpoints: The URL points to an API-style endpoint that triggers a job rather than serving content directly.
- CDN or proxy misconfiguration: A content delivery network or reverse proxy in front of your server is returning 202 while it fetches or generates the resource from the origin.
- On-demand static site generation: Some platforms generate pages on first request and return 202 until the build is complete (e.g., incremental static regeneration that hasn’t cached the page yet).
How to Fix
The core fix is ensuring that the URL you submit to the validator responds with a 200 OK status and delivers the full resource content in the response body. Here are specific steps:
-
Check your server configuration. Make sure your web server or application returns 200 OK for HTML pages and static assets. If background processing is needed, it should happen before the response is sent, or the result should be cached and served directly on subsequent requests.
-
Avoid validating asynchronous endpoints. If a URL is designed to trigger background work (like a webhook or task queue), it’s not a validatable HTML resource. Only submit URLs that serve complete HTML documents.
-
Pre-warm cached content. If your hosting platform uses on-demand generation, visit the URL in a browser first to trigger the build, then validate it once the page is fully generated and cached.
-
Inspect the response headers. Use browser developer tools or a command-line tool like curl -I <url> to verify the status code your server actually returns. Look for the HTTP/1.1 202 Accepted line and trace why it’s being sent.
Examples
Incorrect server behavior (returns 202)
In this conceptual example, the server responds with 202 for an HTML page, which prevents the validator from checking it:
HTTP/1.1 202 Accepted
Content-Type: text/html
<!-- Content may be empty or incomplete -->
If you’re using a Node.js/Express server, this kind of code would cause the problem:
app.get('/page', (req, res) => {
res.status(202).send('<p>Processing...</p>');
// Background work happens later
});
Correct server behavior (returns 200)
The server should respond with 200 OK and the complete HTML content:
HTTP/1.1 200 OK
Content-Type: text/html; charset=utf-8
<!DOCTYPE html>
<html lang="en">
<head>
<title>My Page</title>
</head>
<body>
<h1>Welcome</h1>
<p>This page is fully rendered and ready to validate.</p>
</body>
</html>
The equivalent fix in a Node.js/Express server:
app.get('/page', (req, res) => {
const html = renderPage(); // Generate full content synchronously or await it
res.status(200).send(html);
});
Verifying the status code with curl
You can check what status code a URL returns before submitting it to the validator:
curl -I https://example.com/page
Look for HTTP/1.1 200 OK (or HTTP/2 200) in the first line of the output. If you see 202 Accepted, investigate your server configuration before attempting validation.
Ready to validate your sites?
Start your free trial today.