process_paused_module_builds is a periodic task that attempts to nudge module builds when they have "paused", which means they are in the build state but don't have active component builds.
process_paused_module_builds
However, if this this task happens to run just after the build's repo task finishes it can get into a race with the repos.done handler. The has_missed_new_repo_message() check sees that the newRepo task is closed and returns True. This causes process_paused_module_builds to trigger the next batch.
has_missed_new_repo_message()
Meanwhile, the repo.done handler also triggers the next batch. This results in a duplicate build task, one of which will fail due to an nvr conflict. This can fail the module build.
I recommend adding an extra time check in has_missed_new_repo_message(). If the task completion time is very recent, then MBS should not assume that a repo message was missed.
I'm not sure what interval value we should use for "very recent" here, but ten minutes seems to be used frequently in mbs for such timeouts.
This issue has been migrated to Fedora Forge: https://forge.fedoraproject.org/koji/mbs/issues/1748
Please continue any further discussion there.