DEV Community

Sungsoo Youn
Sungsoo Youn

Posted on Edited on

My Sales Check Said "Couldn't Read the Table" for Nine Days. It Was Looking at a Login Page.

A field note from the autonomous Claude Code agent I run every day on one Windows PC. The numbers come from its own ledgers, not from memory.

Free to read first: a PDF sample of the book behind this setup — its first 3 chapters: https://dbsoul.gumroad.com/l/autonomous-ai-agents-claude-code-free-sample

One of the places that sells my e-book also passes it on to other bookstores. What those stores sell shows up in a monthly sales table on the platform's admin page. Every evening at 18:40 a task opens that page in a browser, reads the table, and adds the bookstore share to my ledger.

The line that didn't say why

From October 31 the evening log had the same red line: "bookstore sales: couldn't read the monthly sales table, not measured (not recorded as zero)". My morning check counted it as nine days in a row.

The line was honest about one thing. The ledger never wrote a zero for those days, so a missing measurement did not turn into "no sales". But it gave no cause.

What the page actually was

On November 12 I opened the same address, read only, and looked at where it landed. It did not land on the sales page. It was sent to the platform's login page.

My login ledger agreed. The daily check for this site said "logged in" up to October 30. Every check recorded from October 31 on said "logged out".

So why did the log talk about a table? The reader goes to the page, then picks a year in a drop-down before reading the table. On the login page there is no drop-down. Waiting for it ran into the 30-second timeout, and that error was caught by the except inside the year loop. That except marks a year it can't read as unread. Here it turned "logged out" into "couldn't read the table".

What the wrong line cost

The bookstore figures are posted once a month, on the 10th. November 10 went by while the line said "couldn't read the table". I still don't know whether anything sold through the stores in that period. My task can't read it until the login is back.

There was one more gap. On November 7 a login window was opened once. It ended without a confirmed login. A rule that stops the same login request from repeating then kept it from opening again. I don't know why that window ended without a login.

What I changed

The reader now checks where the page landed before it touches the drop-down. If the path is the login page, it raises its own error, outside the year loop, so the loop's except can't catch it.

The evening line for that case is now fixed text: "bookstore sales: admin page logged out, not measured (not recorded as zero)", followed by the one command that opens a login window. It stays the same every day, because my repeat counter groups lines by their text. The other failure lines did not change.

The review I run before calling anything done suggested a different kind of test. My first tests called the function that writes the line with a fake reader. They would have passed even if the real reader caught its own error. So I added two tests that run the real reader against a fake browser. In one it lands on the login page and the error has to come out. In the other it lands on the sales page and the table has to be read.

I did not log in myself. My scripts don't handle passwords. The fix gives the right reason and the one step to try.

The rules

  • A failure line should name the cause, not the step that broke. "Couldn't read the table" was the last step. The cause was one page earlier.
  • Check where you landed before you read. A redirect to a login page looks like a broken page to everything after it.
  • A broad except inside a loop needs a check before the loop. Otherwise every new kind of failure gets the loop's label.

Where this comes from. Every post here comes from one setup I run daily: a CLAUDE.md, memory files the agent reads before it touches anything, and a separate auditor agent that returns PASS or FAIL. The first 3 chapters of the book that walks through it are free as a PDF: https://dbsoul.gumroad.com/l/autonomous-ai-agents-claude-code-free-sample

The full edition is 11 chapters plus 4 ready-to-use templates (CLAUDE.md starter, memory files, auditor checklist, measurement guide) and a hands-on section for every chapter, $19 as a PDF: https://dbsoul.gumroad.com/l/autonomous-ai-agents-claude-code

Prefer Google Play? The same book is on Google Play Books: https://play.google.com/store/books/details?id=hesIEgAAQBAJ

Questions about the setup are welcome in the comments — I'll answer with what actually happened, not theory.

Top comments (0)