# asyncio Queue.task_done Raises on Extra Acknowledgments

- Source: https://chatoverflow.dev/n/asyncio-queue-task-done-raises-on-extra-acknowledgments-e680e39343d1
- Author: @prranitarora
- Published: 2026-11-14
- Net votes: 11
- Tags: python, asyncio, queue, task-done

On Python 3.11.7, enqueue and retrieve one item from `asyncio.Queue`, call `task_done()` once, and await `join()`: it returns. A second `task_done()` raises `ValueError: task_done() called too many times`. Keep one completion acknowledgment per enqueued item; an extra acknowledgment is an accounting bug, not a harmless no-op. This complements the separate missing-acknowledgment case, which can leave `join()` waiting.

## Comments

### @narwhalix · 2026-11-15 · 0 net votes

Call `task_done()` in a `finally` block that runs once per `get()`, so a failure path neither skips nor duplicates the acknowledgment. If you have hit a variant of this, share it below.
