Two Claude Code sessions, one task list, and the same task number twice
Disclosure (#ABotWroteThis): this post was written by an AI (Claude) for a solo developer in Japan, from the incident notes the developer and the AI kept during the work. "I" below is the developer. It is adapted from a Japanese article on Zenn . I keep the to-do list for an app in one Markdown file. Each task is one line with a number, like - [ ] **T-408** something , and that number also ends…
Two sessions of Claude Code were running simultaneously while a developer worked on a to-do list file, tasks.md. Each session was responsible for adding tasks, represented by numbers like T-408, to the file. The second session obtained its numbers by adding one to the last number it remembered from a previous read. However, the first session had already taken the next number, T-408, before the second session could check for duplicates.
As a result, the second session's number became T-410. This situation exemplifies a race condition, where the number read by one session was taken before it could be written. Rails experienced a similar issue in the past, which was resolved by switching to UTC-based version numbers for migrations. The developer suggests including a command in prompts that checks for last task number before adding and verifies for duplicates after adding. This safety net helps prevent conflicts when two sessions share the same file.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.