Looking at the script you posted to the forums [1], I think I know
what's happening here.
I'm not sure if we've exactly documented this anywhere, but Zotero API
requests currently aren't guaranteed to be read-after-write consistent,
meaning that the data obtained from a read immediately (up to a fraction
of a second) after a write may not reflect the new data. (This isn't
specific to version numbering — you're just getting an older copy of the
item, without the tag you just added. The version number is protecting
you from overwriting the previous change.)
The usual pattern is to use the data returned by the write request for
the next request, such that a 412 is guaranteed to mean that someone
else modified the item elsewhere. In your case, since you're getting the
items from tag searches (GET requests), that's not really an option, so
adding a delay after the previous write is one workaround. But a
better/faster approach, though a bit more complicated to code, would be
to do all the searches first, deduplicate the items, and then use a
single write request for each item that adds multiple tags, without
needing a delay afterward.
[1]
https://forums.zotero.org/discussion/comment/348274/#Comment_348274