Git Sync Error Null Value

Product: PowerShell Universal
Version: 3.01

Getting this error after setting up Git sync with our internal Bitbucket.

image

It’s a 2 way sync and files from the server made it to the repo ok and are being updated as changes are made however I keep getting this error about a null parameter but not sure what it’s referring to.

I’m not quite sure why this is happening but I’ve opened an issue in our tracker to investigate. I’ll update this thread when I have some more info.

1 Like

Any update to this?
I am on 3.1.4 and getting the same error. I am using GitHub with a PAT.
The sync appears to be working, though i get no logs in GIT, just the errors.
The files synced with this also do not show up in the Scripts tab, just the folders.

2022-07-20 12:38:05.121 +10:00 [ERR] Failed to sync: Value cannot be null. (Parameter 'objectish')    at LibGit2Sharp.Core.Ensure.ArgumentNotNullOrEmptyString(String argumentValue, String argumentName) in /_/LibGit2Sharp/Core/Ensure.cs:line 54
   at LibGit2Sharp.Repository.Lookup(String objectish, GitObjectType type, LookUpOptions lookUpOptions) in /_/LibGit2Sharp/Repository.cs:line 605
   at LibGit2Sharp.Repository.Lookup(String objectish, ObjectType type) in /_/LibGit2Sharp/Repository.cs:line 569
   at LibGit2Sharp.RepositoryExtensions.Lookup[T](IRepository repository, String objectish) in /_/LibGit2Sharp/RepositoryExtensions.cs:line 32
   at UniversalAutomation.Git.GitService.GetChangesSinceCommit(String sha)+MoveNext() in C:\actions-runner\_work\universal\universal\src\Universal.Server\Services\GitService.cs:line 360
   at UniversalAutomation.GitSyncService.TrySync() in C:\actions-runner\_work\universal\universal\src\Universal.Server\Services\GitSyncService.cs:line 199
   at UniversalAutomation.GitSyncService.Sync() in C:\actions-runner\_work\universal\universal\src\Universal.Server\Services\GitSyncService.cs:line 67

Can you enable debug logging? I’m specifically wondering if there is a git commit without a commit ID in the database. It would cause this but we should see a log where it’s trying to find changes for a commit ID that doesn’t exist.

                _logger.LogDebug("Getting changes since {0}", lastSync.CommitId);
                _changes = _gitService.GetChangesSinceCommit(lastSync.CommitId);

You’d see something like this:

[DBG] Getting changes since

That said, I’m not sure why there is a git sync without a commit ID but we should fix this so it will avoid this exception and just write a warning and continue on.

UPDATE: I added a check for this in the git sync to ensure we can handle this issue.

I thought this was just me. I have been banging my head on this issue for a few hours lol

I did notice that under the GIT settings [/admin/settings/git] the remote and branch were showing the same in the UI despite what is configured in the appsettings.json

1 Like

Jumping in here because I’ve just now started to see the same error. Sync is still working, but the error pops up in PSU after every sync.

Did you guys manage to get to the bottom of this?

ps. @mikedhanson I am seeing the same as you in the Git UI. “Branch” is showing the same value as “Remote”, rather than “main” like it used to. @adam that could be a hint!

2 Likes

Here’s my log after switching the log level to Debug. The “Getting changes since null” seems to be the issue.

2022-07-25 12:20:18.825 +10:00 [DBG] Configured logging.
2022-07-25 12:21:15.849 +10:00 [DBG] Repository directory already exists. Validating whether it is a valid git repository.
2022-07-25 12:21:15.866 +10:00 [DBG] Repository directory is valid repository.
2022-07-25 12:21:15.866 +10:00 [INF] Starting sync...
2022-07-25 12:21:15.875 +10:00 [DBG] Git has remote. Starting pull
2022-07-25 12:21:16.572 +10:00 [DBG] Git has remote. Starting push
2022-07-25 12:21:18.015 +10:00 [DBG] Getting changes since null
2022-07-25 12:21:18.127 +10:00 [ERR] Failed to sync: Value cannot be null. (Parameter 'objectish')    at LibGit2Sharp.Core.Ensure.ArgumentNotNullOrEmptyString(String argumentValue, String argumentName) in /_/LibGit2Sharp/Core/Ensure.cs:line 54
   at LibGit2Sharp.Repository.Lookup(String objectish, GitObjectType type, LookUpOptions lookUpOptions) in /_/LibGit2Sharp/Repository.cs:line 605
   at LibGit2Sharp.Repository.Lookup(String objectish, ObjectType type) in /_/LibGit2Sharp/Repository.cs:line 569
   at LibGit2Sharp.RepositoryExtensions.Lookup[T](IRepository repository, String objectish) in /_/LibGit2Sharp/RepositoryExtensions.cs:line 32
   at UniversalAutomation.Git.GitService.GetChangesSinceCommit(String sha)+MoveNext() in C:\actions-runner\_work\universal\universal\src\Universal.Server\Services\GitService.cs:line 360
   at UniversalAutomation.GitSyncService.TrySync() in C:\actions-runner\_work\universal\universal\src\Universal.Server\Services\GitSyncService.cs:line 199
   at UniversalAutomation.GitSyncService.Sync() in C:\actions-runner\_work\universal\universal\src\Universal.Server\Services\GitSyncService.cs:line 67

EDIT: I’m seeing this in the GitStatus database table in case this helps:

My GitSettings table is empty - the settings are coming from appsettings.json (or more specifically, environment variable overrides).

We’re releasing 3.1.5 to address this since the issue is affecting a lot of people.

2 Likes

Yay! Looks like v3.1.5 fixed it for us. We are using Bitbucket and were getting that null error. I did notice that the Branch still shows the full Remote path instead of the Branch name, but that just appears to be a display issue as the syncing is now successful.

Updated to version 3.5.5 and seeing this issue once again.

image

2022-11-23 11:43:28.969 -06:00 [ERR] Failed to sync: Value cannot be null. (Parameter 'name')    at LibGit2Sharp.Core.Ensure.ArgumentNotNull(Object argumentValue, String argumentName) in C:\actions-runner\_work\universal\universal\src\libgit2sharp\LibGit2Sharp\Core\Ensure.cs:line 24
   at LibGit2Sharp.Core.Ensure.ArgumentNotNullOrEmptyString(String argumentValue, String argumentName) in C:\actions-runner\_work\universal\universal\src\libgit2sharp\LibGit2Sharp\Core\Ensure.cs:line 50
   at LibGit2Sharp.Identity..ctor(String name, String email) in C:\actions-runner\_work\universal\universal\src\libgit2sharp\LibGit2Sharp\Identity.cs:line 21
   at UniversalAutomation.Git.GitService.Pull() in C:\actions-runner\_work\universal\universal\src\Universal.Server\Services\GitService.cs:line 388
   at UniversalAutomation.GitSyncService.TrySync(GitStatus status, Boolean force, GitSettings settings) in C:\actions-runner\_work\universal\universal\src\Universal.Server\Services\GitSyncService.cs:line 151
   at UniversalAutomation.GitSyncService.Sync(Boolean force) in C:\actions-runner\_work\universal\universal\src\Universal.Server\Services\GitSyncService.cs:line 87
2022-11-23 11:44:01.757 -06:00 [ERR] Failed to sync: Value cannot be null. (Parameter 'name')    at LibGit2Sharp.Core.Ensure.ArgumentNotNull(Object argumentValue, String argumentName) in C:\actions-runner\_work\universal\universal\src\libgit2sharp\LibGit2Sharp\Core\Ensure.cs:line 24
   at LibGit2Sharp.Core.Ensure.ArgumentNotNullOrEmptyString(String argumentValue, String argumentName) in C:\actions-runner\_work\universal\universal\src\libgit2sharp\LibGit2Sharp\Core\Ensure.cs:line 50
   at LibGit2Sharp.Identity..ctor(String name, String email) in C:\actions-runner\_work\universal\universal\src\libgit2sharp\LibGit2Sharp\Identity.cs:line 21
   at UniversalAutomation.Git.GitService.Pull() in C:\actions-runner\_work\universal\universal\src\Universal.Server\Services\GitService.cs:line 388
   at UniversalAutomation.GitSyncService.TrySync(GitStatus status, Boolean force, GitSettings settings) in C:\actions-runner\_work\universal\universal\src\Universal.Server\Services\GitSyncService.cs:line 151
   at UniversalAutomation.GitSyncService.Sync(Boolean force) in C:\actions-runner\_work\universal\universal\src\Universal.Server\Services\GitSyncService.cs:line 87
2022-11-23 11:45:01.788 -06:00 [ERR] Failed to sync: Value cannot be null. (Parameter 'name')    at LibGit2Sharp.Core.Ensure.ArgumentNotNull(Object argumentValue, String argumentName) in C:\actions-runner\_work\universal\universal\src\libgit2sharp\LibGit2Sharp\Core\Ensure.cs:line 24
   at LibGit2Sharp.Core.Ensure.ArgumentNotNullOrEmptyString(String argumentValue, String argumentName) in C:\actions-runner\_work\universal\universal\src\libgit2sharp\LibGit2Sharp\Core\Ensure.cs:line 50
   at LibGit2Sharp.Identity..ctor(String name, String email) in C:\actions-runner\_work\universal\universal\src\libgit2sharp\LibGit2Sharp\Identity.cs:line 21
   at UniversalAutomation.Git.GitService.Pull() in C:\actions-runner\_work\universal\universal\src\Universal.Server\Services\GitService.cs:line 388
   at UniversalAutomation.GitSyncService.TrySync(GitStatus status, Boolean force, GitSettings settings) in C:\actions-runner\_work\universal\universal\src\Universal.Server\Services\GitSyncService.cs:line 151
   at UniversalAutomation.GitSyncService.Sync(Boolean force) in C:\actions-runner\_work\universal\universal\src\Universal.Server\Services\GitSyncService.cs:line 87

@adam

To fix this I had to delete .git and reset git settings on the server.

Even if you use a PAT make sure you have the username filled out. Not sure if thats required or not.