Fix nil-pointer panic in claimTask and misleading claim logs#10
Merged
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
claimTaskinserve_tasks.gohad a missingreturnin theItemNotFoundErrorbranch — afterackCb()succeeded (settingerr = nil), the code fell through toerr.Error()on line 155, triggering a nil-pointer panic on every claim of a task that had been deleted from the DB while queued.%splaceholders with no arguments.task_client.gonow handles 404 specifically — downgrades the log fromErrortoWarnsince 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🤖 Generated with Claude Code