Sqlpackage publish action stopped working from powershell script

Hi
I have the below powershell code:

$sqlpublish = Start-Process -FilePath sqlpackage.exe -ArgumentList '/Action:Publish','/SourceFile:"Database Services\bin\Release\Database Services.dacpac"',"/TargetConnectionString:""Data Source=${Env};Integrated Security=True;Persist Security Info=False;Pooling=False;MultipleActiveResultSets=False;Connect Timeout=60;Encrypt=False;TrustServerCertificate=False;Initial catalog=${Target}""","/p:BlockOnPossibleDataLoss=${Data_loss}" -wait -PassThru -Credential $Cred -RedirectStandardOutput sqlstdout.txt -RedirectStandardError sqlstderr.txt
$sqlpublish.WaitForExit()
$sqlpublish

if ($sqlpublish.ExitCode -eq 0) {
  Get-Content sqlstdout.txt
 }
 else {
      echo "An error occurred"
      Get-Content sqlstderr.txt
      exit $sqlpublish.ExitCode
 }

up until now it worked fine, but suddenly it fails, and the sqlstderr.txt is empty, so I have no clue what is the reason. can you please advise?

The error handling above is getting redirected output from sqlpackage.exe, but not if Start-Process fails (bad creds, the exe doesn’t exist, etc.). $sqlPublish could be null and still hit that else block because the ExitCode is not 0. Where is the code being executed? Is there an error for Start-Process that can be captured?