cachly← All posts
Proof over claim

Three times my AI said "Build: pass". Three times the server died.

My AI said "Build: pass" three times in six weeks. All three times, the thing we were about to ship died the moment it started. Not one of the green checks had ever started it.

That is the whole bug. The rest of this post is how it hid, and the one line that finds it.

Scene one: the feature that compiled

August. A coding agent had spent four rounds building a billing check into a logistics app I run. Its report, boiled down:

tsc: pass
tests: 92 passed
web build: pass
Build: pass

All true. Then a second pass did something none of those steps had done: it built the server and started it.

Error [ERR_MODULE_NOT_FOUND]: Cannot find module '.../dist/lib/lane-select'

One new file imported ./lane-select. Every other file in the repo wrote ./lane-select.js. Three routes imported that new file, so the API would not have come up at all after the deploy. Green pipeline, dead server.

Who checked what

Scene two: the guard that wasn't asked

You'd think we learned. We did, partly: there was now a CI check that scans for exactly this, a relative import without .js.

September, around midnight. A small patch from my AI added import { ... } from "./extraktion" to the background worker. No .js. The CI check would have caught it in seconds.

It never got the chance. My AI told the GitHub CLI to merge the pull request "when the checks pass". That repo didn't allow auto-merge, so the command didn't wait. It merged on the spot and said nothing about it.

The deploy went green. The health check went green. The worker sat in a restart loop for 24 minutes, from 22:03 to 22:27 UTC, and the only thing that showed it was a container list saying Restarting. The health check only ever asked the API, and the API was fine.

Everything green. The worker, not so much.

Scene three, which was actually scene one

The first time had been in July, and I'd filed it under bad luck. A change made the API import a shared package at runtime for the first time. That package had no build step: raw TypeScript, re-exports without file extensions. The web app compiled it away, so the web app was happy. The API container ran it directly and crashed on start, over and over, until we rolled back to the last good image.

Three incidents. Three different files. One cause.

Why every check said yes

Here is the uncomfortable part: none of the tools was wrong.

Three tools agreed. The runtime disagreed. And the runtime was the only one not on the checklist.

That's the class of bug, and it's much bigger than ESM file extensions: your checks test the source, your users get the artifact. Anything that differs between the two (resolution rules, a missing file in the image, an environment variable that only exists in CI, a migration that never ran) passes every check and fails on start.

The two-minute check

Open your CI file and answer one question: which step starts what you ship? Not builds it. Starts it.

If the answer is "none", add one. For a Node service it can be a single line after the build:

node --input-type=module -e "await import('./dist/server.js'); process.exit(0)"

It loads the compiled entry point the way production will, with the same resolution rules, and exits. If an import is broken, it fails here instead of after the deploy. If importing your entry file already opens ports or database connections, import the module one level below it instead. We load app.js, which builds the API but doesn't listen, and the worker's index.js, which only starts its loop when it is run directly. Do it for every entry point you ship. We had forgotten the worker exactly because it had no health endpoint, so nothing ever pointed at it.

The step that starts what you ship

If you ship containers, the same idea one level up: start the image you just built and ask it something, before anyone merges.

Scene four: while writing this post

I wanted to end with a tidy list of what we fixed. So I opened the pipeline to copy it out, and found the list was shorter than I remembered.

After scene one, we did add a boot check: build, then load the compiled API. It ran in the local task gate, not in CI. And it loaded the API only. The worker, the one from scene two, wasn't in it. Nothing in CI started anything at all. Three incidents in, the exact gap from scene two was still open.

So the receipts for this post are from the day I wrote it:

And one thing that is still open: after a deploy, the pipeline still only asks the API. The worker check belongs on the server side, and it's next. I'd rather tell you that than pretend.

None of this is clever. It's just making the pipeline do the one thing production does in its first second: start.

Next in this series: I let AI agents write my tests, and 13 of them passed without ever testing the code.


What does your "build: pass" actually start?

cachly.dev

For solo developers, teams and whole companies

Explain it once. Every AI knows it.

Shared team memory between your code, your tickets and your AI. Hosted in the EU, in every tool. cachly keeps the fixes, the decisions and the traps, so the next session starts with them. Claude Code, Cursor, Copilot, Windsurf, Codex, Gemini CLI and JetBrains all read it. Free for one project, no card needed.

Servers in the EU · one command, restart your editor, done · 1 project free

Four ways to install

Claude Code
/plugin marketplace add cachly-dev/cachly-mcp
/plugin install cachly-brain@cachly

Then turn on auto-update once: /plugin → Marketplaces → cachly → Enable auto-update

Any MCP editor
npx @cachly-dev/mcp-server@latest autopilot