I can see two possibilities there.
1. You are using more than one input/output for that same file and when saving to the Gallery, the workflow can run the tools in a different order giving that error.
2. Unknown error caused by a bug. In that case, I would suggest you to create a simple workflow with a brand new output tool with that same configuration and see how that goes.