I had the same issue for the past two days with Sectigo (Comodo CA) where all my post build signings kept randomly failing. Has been fine for two years and interestingly exactly 1-year to the day before the certificate expires these errors start happening. It seems as though it would work with a single build but for multiple builds it would randomly complain about one of them and not always the same.
changing my post build event from:
signtool.exe sign /f "$(ProjectDir)my-cert.pfx" /p mypassword /t http://timestamp.comodoca.com/authenticode "$(TargetDir)$(TargetName).dll"
to:
signtool.exe sign /f "$(ProjectDir)my-cert.pfx" /p mypassword /t http://timestamp.digicert.com "$(TargetDir)$(TargetName).dll"
solved the problem.