# Two workers could undo each other's changes

> A catalog worker's update to .NET would have removed a relation another worker added a minute earlier: an admin update replaced the whole record without checking it was still the one read. Updates now send the version they read, and a stale one is refused.

Source: https://talira.ai/dev-log/lost-updates
All of Talira's documentation: https://talira.ai/llms.txt

23 November 2026

**What went wrong:** A worker read .NET's record, another worker added that .NET implements C#, and the first worker's update, built from the record it had read, would have taken that out again. Its dry run's diff showed the removal, so nothing was lost this time, but with four workers in parallel the next one might not have looked.

## Evidence

- [The tests for versions on listing updates](https://github.com/talira-ai/talira/blob/main/server/tests/admin.rs)
- [The tests for versions on organization updates](https://github.com/talira-ai/talira/blob/main/server/tests/catalog_writers.rs)
- [The listing queue's guide to changing a listing](https://github.com/talira-ai/talira/blob/main/docs/QUEUE.md)

## Why

`PUT /api/v1/admin/listings/{uid}` and `PUT /api/v1/admin/organizations/{uid}` replaced the whole record with what
they were sent, which is right when the writer has the latest record and wrong when someone wrote in between. The
22 November fix for organizations made workers read before they update; it didn't stop a read going stale.

Now both `GET`s give the record's `version`, and every update sends it back as `expected_version` (the admin MCP tools
too). An update whose version is stale is refused with `409 version_conflict`, carrying the record and version as they
are now, so the worker applies its change to that record instead of its own copy. The check is made under the
catalog's write lock, so nothing can slip in between it and the write.
