Is your script setting more than one value in a record as it loops through records?
Or is it doing a Replace Field Contents on a found set of Records?
Or acting on groups of related records?
It sounds like the script is trying to act on more than one value before committing the changes, and the record (or parent record) is locked, so it cannot commit the multiple edits.
Hmm, haha all of the above?
It does a loop on a found set where it sets up to 5 fields per record.
It does several Replace Field Contents on All Records.
And there's an occasional Replace Field Contents that is for related records.
You must be right about it locking its own record, but it's just strange that this was just a one-time error, and not something that happens when I step through the script on my own.
I'll take a look through though and see if I can add some record commits along the way, just in case.
Explicit record commits after each edit should solve the problem if it's your routines running into each other.
If this is a server-side script, try breaking the different parts of the edits into different scripts and set them to run on separate schedules that can't collide.