Hydration Proof

Search documentation

Find a page or section

HP9005: The server answered with an error status

HP9005 (http-error) means the page's document response had an HTTP error status such as 404 or 500. Fix the route, or list the status the route should return.

HP9005 (http-error) means the document response for the route had an HTTP error status, 400 or above, such as a 404 or a 500. The page may still hydrate, but it is probably not the page you meant to test. Make the route return a success status, or list the status in the route's expected statuses.

CodeHP9005
Namehttp-error
Default severityError
GroupTest run problems
What it meansThe document response had an HTTP error status.

What the HP9005 http error finding means

hydration-proof checks the status of the document the browser received:

The server answered 500 for http://localhost:3000/products/42.

It is an error unless the status is listed in the route's expectStatus. The page is still tested, so a custom 404 page that hydrates with a mismatch is reported as well.

Likely causes

  • A dynamic route tested with an example value that does not exist, for example a product id from routes.dynamic that is not in the test database.
  • A server error on this route: check the server logs.
  • A signed-in page that answers 401 or 403 to a guest scenario.
  • An error page on purpose, such as a route for your 404 page.

How to fix it

Make the route return a success status, or list the status in the route's expected statuses.

  1. For a server error, fix the route; the server logs have the stack trace.
  2. For missing data, use example values that exist, or seed them in hooks.setup.
  3. For signed-in pages, test them in a scenario that signs in (see scenarios).
  4. For a page that should answer with an error, set expectStatus:
hydration-proof.config.ts
import { defineConfig } from "hydration-proof";
 
export default defineConfig({
  routes: {
    paths: ["/", "/pricing", { path: "/404-page", expectStatus: [404] }],
  },
});

For Next.js, routes.notFound already loads a URL that does not exist and expects a 404, to check that the not-found page hydrates. Routes lists every route option.