2026.3.4 Git Sync "Failed" when initialize.ps1 throws an error after sync

2026.3.4 Git Sync "Failed" when initialize.ps1 throws an error after sync

avatar

This would not be an issue except the Git sync status just shows "Failed" and there is no indication that the problem is not with Git but a PowerShell Universal script failing to run.

If the Git sync is going to fail for reasons that are not Git related there should be some better output to show what caused the failure.

All Comments (1)

avatar

Hello Shannon,

Thank you for contacting the Delutions support team.

We have not reproduced this on our side yet, so I opened an investigation ticket.

I agree that the status should point to initialize.ps1 instead of reporting a Git problem.

As far as I can tell, when a sync has to reload the whole configuration, PowerShell Universal runs .universal/initialize.ps1 first.

If the script writes any error, even a non-terminating one, the sync can be recorded as a generic failure.

In the meantime, the real error should be in the system log.

Look for an "Exception:" line from UniversalConfigurationService just before "Git sync <id> failed with result".

As a workaround, make sure initialize.ps1 does not write error records:

  • Wrap steps that can fail in try/catch.

  • Use -ErrorAction SilentlyContinue or -ErrorAction Ignore where an error is expected and harmless.

  • Write the problem to your own log file, because warnings and output from initialize.ps1 are not recorded.

For example:

try {
    # The step that can fail, with -ErrorAction Stop on the cmdlet
}
catch {
    Add-Content -Path 'C:\Logs\psu-initialize.log' -Value "$(Get-Date -Format o) $($_.Exception.Message)"
}

Use a path outside the repository folder, so Git sync does not pick up the log file.

Then click Synchronize Now on the Git page, or run Sync-PSUGit.

To help the investigation, could you send me the following:

  • The system log lines around a failed sync.

  • The error your initialize.ps1 writes, or the script itself if you can share it.

  • Your operating system, install type (service, IIS or Docker) and database.

I will keep you posted as soon as I hear back from the team.

The configuration scripts are described here: https://docs.devolutions.net/powershell-universal/config/repository

Git sync settings and troubleshooting are described here: https://docs.devolutions.net/powershell-universal/config/git

Best regards,

Patrick Ouimet