# Publishing failed

Claude tried to publish and Hatchik said it did not work. Nothing has changed
for your visitors: a failed publish never replaces what was already live. If
this was the first publish, there is nothing live yet.

## What happened

Hatchik builds your app, starts it, and then waits for the app to answer a
health check. If the app never answers, or crashes and keeps restarting, Hatchik
stops there and marks the publish as failed.

When that happens, the failure comes back with the last 200 lines of the app's
own log attached. Claude gets those lines in the same reply. It can almost
always read the real error and fix it in the next message.

## What to do

Say "that failed, have a look at the logs and fix it". That is the whole
instruction. If Claude has already moved on, ask it to show you the recent logs
for the project, and it will fetch them fresh.

If two or three attempts do not fix it, ask Claude to go back to the last
version that worked, and try the change again in smaller pieces.

## The usual causes

For your AI, in order of how often they happen:

- **The app listens on `127.0.0.1` instead of `0.0.0.0`.** Nothing outside the
  container can reach it. Bind `0.0.0.0`.
- **There is no `GET /healthz` returning 200.** Hatchik polls it to decide the
  app is up. Without it, every publish fails, even though the app itself is
  fine.
- **The app listens on the wrong port.** It must read the `PORT` environment
  variable, which Hatchik sets to 8000.
- **There is no `Dockerfile` at the root of the files.** Hatchik builds an app
  from it. This one fails immediately with its own clear message rather than
  timing out.
- **A database migration fails at startup**, usually because it assumes a table
  that does not exist yet, or runs before Postgres is accepting connections.
  Retry the connection at boot, or connect on the first request.
- **A dependency is missing from the image** — `ModuleNotFoundError` and
  friends. It is in the code but not in the Dockerfile.

The full contract is on the "How apps run on Hatchik" page.

## What this is not

It is not a Hatchik outage, and it is not your card. A failed publish is your
app not starting. If your live site went down without you publishing anything,
read "My site is broken" instead.
