Skip to content

Fix nil-pointer panic in claimTask and misleading claim logs#10

Merged
turtlemonvh merged 2 commits into
masterfrom
ai/fix-claim-panic
Apr 16, 2026
Merged

Fix nil-pointer panic in claimTask and misleading claim logs#10
turtlemonvh merged 2 commits into
masterfrom
ai/fix-claim-panic

Conversation

@turtlemonvh

Copy link
Copy Markdown
Owner

Summary

  • Panic fix: claimTask in serve_tasks.go had a missing return in the ItemNotFoundError branch — after ackCb() succeeded (setting err = nil), the code fell through to err.Error() on line 155, triggering a nil-pointer panic on every claim of a task that had been deleted from the DB while queued.
  • Format string fix: the ack-error path had %s placeholders with no arguments.
  • Worker log level: task_client.go now handles 404 specifically — downgrades the log from Error to Warn since a deleted/stopped task in the queue is a normal race condition, not an operational error. Returns (Task{}, nil) so the worker retries cleanly instead of logging a scary error every poll interval.

Test plan

  • TestClaim_DeletedTaskDoesNotPanic — creates a task, deletes it from the DB, then claims; asserts no panic + 404 response
  • All existing Go, smoke, and Playwright tests pass

🤖 Generated with Claude Code

turtlemonvh and others added 2 commits April 15, 2026 23:13
The ItemNotFoundError branch in claimTask was missing a return,
falling through to err.Error() after ackCb() set err to nil —
triggering a panic on every claim of a deleted task.

Also fixes: broken format string on the ack error path (line 149
had %s placeholders with no args), and downgrades the worker-side
404 log from Error to Warn since a deleted/stopped task in the
queue is a normal race condition, not an operational error.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@turtlemonvh turtlemonvh merged commit 38fcf41 into master Apr 16, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant