question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

SyntaxError: Unexpected end of JSON input

See original GitHub issue

Hi

We have been using the GitTools task in Azure DevOps happily for over 2 years and it has been working great. Then all of a sudden a few days ago it has started failing with the following error: “SyntaxError: Unexpected end of JSON input”.

Strangely the error seems to only occur in any newly created pipelines, any existing pipelines (prior to a few days ago) in the same repo/branch, it carries on working fine.

The error is raised when we run the following task:

- task: gitversion/execute@0 displayName: ‘Execute GitVersion’ inputs: useConfigFile: false

The "gitversion/setup@0"task is downloading and using GitVersion 5.10.3, and the version has not changed recently. I believe 5.10.3 is the latest version.

Tool ‘gitversion.tool’ (version ‘5.10.3’) was successfully installed. Caching tool: GitVersion.Tool 5.10.3 x64

Any help with this would be greatly appreciated. We have not changed anything with our pipeline/repo implementation/configuration, so we are stumped to why it has suddenly stopped working.

The full log of the task is here:

2022-09-08T06:44:49.7153411Z ##[section]Starting: Execute GitVersion 2022-09-08T06:44:49.7293159Z ============================================================================== 2022-09-08T06:44:49.7293544Z Task : Execute GitVersion Task 2022-09-08T06:44:49.7293855Z Description : Easy Semantic Versioning (http://semver.org) for projects using Git 2022-09-08T06:44:49.7294129Z Version : 0.9.13 2022-09-08T06:44:49.7294349Z Author : GitTools Contributors 2022-09-08T06:44:49.7294670Z Help : See the documentation for help 2022-09-08T06:44:49.7295041Z ============================================================================== 2022-09-08T06:44:50.0254563Z Command: dotnet-gitversion D:/a/1/s /output json /output buildserver 2022-09-08T06:44:50.0258797Z [command]C:\hostedtoolcache\windows\GitVersion.Tool\5.10.3\x64\dotnet-gitversion.exe D:/a/1/s /output json /output buildserver 2022-09-08T06:44:51.1675968Z INFO [09/08/22 6:44:50:47] Working directory: D:/a/1/s 2022-09-08T06:44:51.1677354Z INFO [09/08/22 6:44:50:68] Project root is: D:\a\1\s
2022-09-08T06:44:51.1678019Z INFO [09/08/22 6:44:50:68] DotGit directory is: D:\a\1\s.git 2022-09-08T06:44:51.1678708Z INFO [09/08/22 6:44:50:68] Branch from build environment: refs/heads/gitversion-error 2022-09-08T06:44:51.1679501Z INFO [09/08/22 6:44:50:68] Begin: Normalizing git directory for branch ‘refs/heads/gitversion-error’ 2022-09-08T06:44:51.1680585Z INFO [09/08/22 6:44:50:72] One remote found (origin -> ‘https://%%%%%%@dev.azure.com/%%%%%%/%%%%%%/_git/%%%%%%’). 2022-09-08T06:44:51.1682047Z INFO [09/08/22 6:44:50:72] Skipping fetching, if GitVersion does not calculate your version as expected you might need to allow fetching or use dynamic repositories 2022-09-08T06:44:51.1685460Z INFO [09/08/22 6:44:50:73] Creating local branch gitversion-error 2022-09-08T06:44:51.1686456Z INFO [09/08/22 6:44:50:77] Creating local branch from remote tracking ‘refs/remotes/origin/42fed851e0050dc5227d461cb2fcf1086db89f5b’. 2022-09-08T06:44:51.1687579Z INFO [09/08/22 6:44:50:79] HEAD points at branch ‘refs/heads/gitversion-error’. 2022-09-08T06:44:51.1690827Z INFO [09/08/22 6:44:50:79] End: Normalizing git directory for branch ‘refs/heads/gitversion-error’ (Took: 105.96ms) 2022-09-08T06:44:51.1693956Z INFO [09/08/22 6:44:50:80] Begin: Loading version variables from disk cache 2022-09-08T06:44:51.1695001Z INFO [09/08/22 6:44:50:80] Cache file D:\a\1\s.git\gitversion_cache\46DC55E6B2D286B169686372F5F37D58E41CDEB9.yml not found. 2022-09-08T06:44:51.1697428Z INFO [09/08/22 6:44:50:80] End: Loading version variables from disk cache (Took: 0.51ms) 2022-09-08T06:44:51.1698964Z INFO [09/08/22 6:44:50:80] Using latest commit on specified branch 2022-09-08T06:44:51.1699763Z INFO [09/08/22 6:44:50:96] No branch configuration found for branch gitversion-error, falling back to default configuration 2022-09-08T06:44:51.1702065Z INFO [09/08/22 6:44:50:97] Begin: Attempting to inherit branch configuration from parent branch 2022-09-08T06:44:51.1703849Z INFO [09/08/22 6:44:50:97] End: Attempting to inherit branch configuration from parent branch (Took: 8.03ms) 2022-09-08T06:44:51.1705950Z INFO [09/08/22 6:44:51:06] Attempting to show the current git graph (please include in issue):

2022-09-08T06:44:51.1707540Z ERROR [09/08/22 6:44:51:06] An unexpected error occurred: 2022-09-08T06:44:51.1708297Z System.NullReferenceException: Object reference not set to an instance of an object. 2022-09-08T06:44:51.1711622Z at LibGit2Sharp.Core.Handles.ObjectHandle.op_Implicit(ObjectHandle handle) in //LibGit2Sharp/Core/Handles/Objects.cs:line 509 2022-09-08T06:44:51.1713897Z at LibGit2Sharp.Core.Proxy.git_commit_author(ObjectHandle obj) in //LibGit2Sharp/Core/Proxy.cs:line 289 2022-09-08T06:44:51.1715716Z at LibGit2Sharp.Core.LazyGroup1.Dependent2.LibGit2Sharp.Core.LazyGroup<T>.IEvaluator<TInput>.Evaluate(TInput input) in //LibGit2Sharp/Core/LazyGroup.cs:line 88 2022-09-08T06:44:51.1721649Z at LibGit2Sharp.Core.LazyGroup1.<Evaluate>b__6_0(T input) in /_/LibGit2Sharp/Core/LazyGroup.cs:line 36 2022-09-08T06:44:51.1724384Z at LibGit2Sharp.Core.GitObjectLazyGroup.EvaluateInternal(Action1 evaluator) in //LibGit2Sharp/Core/GitObjectLazyGroup.cs:line 20 2022-09-08T06:44:51.1726824Z at LibGit2Sharp.Core.LazyGroup1.Evaluate() in /_/LibGit2Sharp/Core/LazyGroup.cs:line 34 2022-09-08T06:44:51.1727737Z at LibGit2Sharp.Core.LazyGroup1.Dependent2.Evaluate() in /_/LibGit2Sharp/Core/LazyGroup.cs:line 80 2022-09-08T06:44:51.1729606Z at LibGit2Sharp.Core.LazyGroup1.Dependent2.get_Value() in /_/LibGit2Sharp/Core/LazyGroup.cs:line 73 2022-09-08T06:44:51.1730465Z at LibGit2Sharp.Commit.get_Committer() in /_/LibGit2Sharp/Commit.cs:line 87 2022-09-08T06:44:51.1731416Z at GitVersion.Commit..ctor(Commit innerCommit) in D:\a\GitVersion\GitVersion\src\GitVersion.LibGit2Sharp\Git\Commit.cs:line 17 2022-09-08T06:44:51.1732513Z at GitVersion.Commit.<>c.<.ctor>b__3_0(Commit parent) in D:\a\GitVersion\GitVersion\src\GitVersion.LibGit2Sharp\Git\Commit.cs:line 16 2022-09-08T06:44:51.1733450Z at System.Linq.Enumerable.SelectEnumerableIterator2.MoveNext() 2022-09-08T06:44:51.1734025Z at System.Linq.Enumerable.Count[TSource](IEnumerable1 source) 2022-09-08T06:44:51.1735739Z at GitVersion.Configuration.BranchConfigurationCalculator.InheritBranchConfiguration(Int32 recursions, IBranch targetBranch, BranchConfig branchConfiguration, ICommit currentCommit, Config configuration, IList1 excludedInheritBranches) in D:\a\GitVersion\GitVersion\src\GitVersion.Core\Configuration\BranchConfigurationCalculator.cs:line 77 2022-09-08T06:44:51.1737739Z at GitVersion.Configuration.BranchConfigurationCalculator.GetBranchConfigurationInternal(Int32 recursions, IBranch targetBranch, ICommit currentCommit, Config configuration, IList1 excludedInheritBranches) in D:\a\GitVersion\GitVersion\src\GitVersion.Core\Configuration\BranchConfigurationCalculator.cs:line 54 2022-09-08T06:44:51.1739085Z at GitVersion.Configuration.BranchConfigurationCalculator.GetBranchConfiguration(IBranch targetBranch, ICommit currentCommit, Config configuration, IList1 excludedInheritBranches) in D:\a\GitVersion\GitVersion\src\GitVersion.Core\Configuration\BranchConfigurationCalculator.cs:line 28 2022-09-08T06:44:51.1740095Z at GitVersion.GitVersionContextFactory.Create(GitVersionOptions gitVersionOptions) in D:\a\GitVersion\GitVersion\src\GitVersion.Core\Core\GitVersionContextFactory.cs:line 39 2022-09-08T06:44:51.1740942Z at GitVersion.GitVersionCoreModule.<>c__DisplayClass0_0.<RegisterTypes>b__1() in D:\a\GitVersion\GitVersion\src\GitVersion.Core\GitVersionCoreModule.cs:line 37 2022-09-08T06:44:51.1741554Z at System.Lazy1.ViaFactory(LazyThreadSafetyMode mode) 2022-09-08T06:44:51.1742294Z at System.Lazy1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor) 2022-09-08T06:44:51.1743012Z at System.Lazy1.CreateValue() 2022-09-08T06:44:51.1743812Z at System.Lazy1.get_Value() 2022-09-08T06:44:51.1744725Z at GitVersion.VersionCalculation.NextVersionCalculator.get_context() in D:\a\GitVersion\GitVersion\src\GitVersion.Core\VersionCalculation\NextVersionCalculator.cs:line 15 2022-09-08T06:44:51.1746011Z at GitVersion.VersionCalculation.NextVersionCalculator.FindVersion() in D:\a\GitVersion\GitVersion\src\GitVersion.Core\VersionCalculation\NextVersionCalculator.cs:line 30 2022-09-08T06:44:51.1747580Z at GitVersion.GitVersionCalculateTool.CalculateVersionVariables() in D:\a\GitVersion\GitVersion\src\GitVersion.Core\Core\GitVersionCalculateTool.cs:line 52 2022-09-08T06:44:51.1748945Z at GitVersion.GitVersionExecutor.RunGitVersionTool(GitVersionOptions gitVersionOptions) in D:\a\GitVersion\GitVersion\src\GitVersion.App\GitVersionExecutor.cs:line 66

2022-09-08T06:44:51.1749961Z INFO [09/08/22 6:44:51:06] Showing max of 100 commits 2022-09-08T06:44:51.1751080Z INFO [09/08/22 6:44:51:13] * 42fed85 18 hours ago (grafted, HEAD -> gitversion-error, origin/42fed851e0050dc5227d461cb2fcf1086db89f5b, 42fed851e0050dc5227d461cb2fcf1086db89f5b) 2022-09-08T06:44:51.1752252Z 2022-09-08T06:44:51.1752578Z INFO [09/08/22 6:44:50:39] Applicable build agent found: ‘AzurePipelines’. 2022-09-08T06:44:51.1752946Z INFO [09/08/22 6:44:50:47] Working directory: D:/a/1/s 2022-09-08T06:44:51.1753289Z INFO [09/08/22 6:44:50:68] Project root is: D:\a\1\s
2022-09-08T06:44:51.1753627Z INFO [09/08/22 6:44:50:68] DotGit directory is: D:\a\1\s.git 2022-09-08T06:44:51.1754871Z INFO [09/08/22 6:44:50:68] Branch from build environment: refs/heads/gitversion-error 2022-09-08T06:44:51.1755361Z INFO [09/08/22 6:44:50:68] Begin: Normalizing git directory for branch ‘refs/heads/gitversion-error’ 2022-09-08T06:44:51.1756001Z INFO [09/08/22 6:44:50:72] One remote found (origin -> ‘https://%%%%%%@dev.azure.com/%%%%%%/%%%%%%/_git/%%%%%%’). 2022-09-08T06:44:51.1756750Z INFO [09/08/22 6:44:50:72] Skipping fetching, if GitVersion does not calculate your version as expected you might need to allow fetching or use dynamic repositories 2022-09-08T06:44:51.1757291Z INFO [09/08/22 6:44:50:73] Creating local branch gitversion-error 2022-09-08T06:44:51.1757796Z INFO [09/08/22 6:44:50:77] Creating local branch from remote tracking ‘refs/remotes/origin/42fed851e0050dc5227d461cb2fcf1086db89f5b’. 2022-09-08T06:44:51.1758303Z INFO [09/08/22 6:44:50:79] HEAD points at branch ‘refs/heads/gitversion-error’. 2022-09-08T06:44:51.1758802Z INFO [09/08/22 6:44:50:79] End: Normalizing git directory for branch ‘refs/heads/gitversion-error’ (Took: 105.96ms) 2022-09-08T06:44:51.1759271Z INFO [09/08/22 6:44:50:80] Begin: Loading version variables from disk cache 2022-09-08T06:44:51.1759775Z INFO [09/08/22 6:44:50:80] Cache file D:\a\1\s.git\gitversion_cache\46DC55E6B2D286B169686372F5F37D58E41CDEB9.yml not found. 2022-09-08T06:44:51.1760284Z INFO [09/08/22 6:44:50:80] End: Loading version variables from disk cache (Took: 0.51ms) 2022-09-08T06:44:51.1760925Z INFO [09/08/22 6:44:50:80] Using latest commit on specified branch 2022-09-08T06:44:51.1761392Z INFO [09/08/22 6:44:50:96] No branch configuration found for branch gitversion-error, falling back to default configuration 2022-09-08T06:44:51.1761915Z INFO [09/08/22 6:44:50:97] Begin: Attempting to inherit branch configuration from parent branch 2022-09-08T06:44:51.1762405Z INFO [09/08/22 6:44:50:97] End: Attempting to inherit branch configuration from parent branch (Took: 8.03ms) 2022-09-08T06:44:51.1762851Z ERROR [09/08/22 6:44:51:06] An unexpected error occurred: 2022-09-08T06:44:51.1763239Z System.NullReferenceException: Object reference not set to an instance of an object. 2022-09-08T06:44:51.1763750Z at LibGit2Sharp.Core.Handles.ObjectHandle.op_Implicit(ObjectHandle handle) in //LibGit2Sharp/Core/Handles/Objects.cs:line 509 2022-09-08T06:44:51.1764318Z at LibGit2Sharp.Core.Proxy.git_commit_author(ObjectHandle obj) in //LibGit2Sharp/Core/Proxy.cs:line 289 2022-09-08T06:44:51.1764942Z at LibGit2Sharp.Core.LazyGroup1.Dependent2.LibGit2Sharp.Core.LazyGroup<T>.IEvaluator<TInput>.Evaluate(TInput input) in //LibGit2Sharp/Core/LazyGroup.cs:line 88 2022-09-08T06:44:51.1765566Z at LibGit2Sharp.Core.LazyGroup1.<Evaluate>b__6_0(T input) in /_/LibGit2Sharp/Core/LazyGroup.cs:line 36 2022-09-08T06:44:51.1766213Z at LibGit2Sharp.Core.GitObjectLazyGroup.EvaluateInternal(Action1 evaluator) in //LibGit2Sharp/Core/GitObjectLazyGroup.cs:line 20 2022-09-08T06:44:51.1767342Z at LibGit2Sharp.Core.LazyGroup1.Evaluate() in /_/LibGit2Sharp/Core/LazyGroup.cs:line 34 2022-09-08T06:44:51.1767829Z at LibGit2Sharp.Core.LazyGroup1.Dependent2.Evaluate() in /_/LibGit2Sharp/Core/LazyGroup.cs:line 80 2022-09-08T06:44:51.1768346Z at LibGit2Sharp.Core.LazyGroup1.Dependent2.get_Value() in /_/LibGit2Sharp/Core/LazyGroup.cs:line 73 2022-09-08T06:44:51.1768806Z at LibGit2Sharp.Commit.get_Committer() in /_/LibGit2Sharp/Commit.cs:line 87 2022-09-08T06:44:51.1769425Z at GitVersion.Commit..ctor(Commit innerCommit) in D:\a\GitVersion\GitVersion\src\GitVersion.LibGit2Sharp\Git\Commit.cs:line 17 2022-09-08T06:44:51.1770064Z at GitVersion.Commit.<>c.<.ctor>b__3_0(Commit parent) in D:\a\GitVersion\GitVersion\src\GitVersion.LibGit2Sharp\Git\Commit.cs:line 16 2022-09-08T06:44:51.1770585Z at System.Linq.Enumerable.SelectEnumerableIterator2.MoveNext() 2022-09-08T06:44:51.1770959Z at System.Linq.Enumerable.Count[TSource](IEnumerable1 source) 2022-09-08T06:44:51.1771841Z at GitVersion.Configuration.BranchConfigurationCalculator.InheritBranchConfiguration(Int32 recursions, IBranch targetBranch, BranchConfig branchConfiguration, ICommit currentCommit, Config configuration, IList1 excludedInheritBranches) in D:\a\GitVersion\GitVersion\src\GitVersion.Core\Configuration\BranchConfigurationCalculator.cs:line 77 2022-09-08T06:44:51.1773951Z at GitVersion.Configuration.BranchConfigurationCalculator.GetBranchConfigurationInternal(Int32 recursions, IBranch targetBranch, ICommit currentCommit, Config configuration, IList1 excludedInheritBranches) in D:\a\GitVersion\GitVersion\src\GitVersion.Core\Configuration\BranchConfigurationCalculator.cs:line 54 2022-09-08T06:44:51.1775251Z at GitVersion.Configuration.BranchConfigurationCalculator.GetBranchConfiguration(IBranch targetBranch, ICommit currentCommit, Config configuration, IList1 excludedInheritBranches) in D:\a\GitVersion\GitVersion\src\GitVersion.Core\Configuration\BranchConfigurationCalculator.cs:line 28 2022-09-08T06:44:51.1776256Z at GitVersion.GitVersionContextFactory.Create(GitVersionOptions gitVersionOptions) in D:\a\GitVersion\GitVersion\src\GitVersion.Core\Core\GitVersionContextFactory.cs:line 39 2022-09-08T06:44:51.1777641Z at GitVersion.GitVersionCoreModule.<>c__DisplayClass0_0.<RegisterTypes>b__1() in D:\a\GitVersion\GitVersion\src\GitVersion.Core\GitVersionCoreModule.cs:line 37 2022-09-08T06:44:51.1778318Z at System.Lazy1.ViaFactory(LazyThreadSafetyMode mode) 2022-09-08T06:44:51.1778873Z at System.Lazy1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor) 2022-09-08T06:44:51.1779322Z at System.Lazy1.CreateValue() 2022-09-08T06:44:51.1779627Z at System.Lazy1.get_Value() 2022-09-08T06:44:51.1780236Z at GitVersion.VersionCalculation.NextVersionCalculator.get_context() in D:\a\GitVersion\GitVersion\src\GitVersion.Core\VersionCalculation\NextVersionCalculator.cs:line 15 2022-09-08T06:44:51.1781181Z at GitVersion.VersionCalculation.NextVersionCalculator.FindVersion() in D:\a\GitVersion\GitVersion\src\GitVersion.Core\VersionCalculation\NextVersionCalculator.cs:line 30 2022-09-08T06:44:51.1782068Z at GitVersion.GitVersionCalculateTool.CalculateVersionVariables() in D:\a\GitVersion\GitVersion\src\GitVersion.Core\Core\GitVersionCalculateTool.cs:line 52 2022-09-08T06:44:51.1782949Z at GitVersion.GitVersionExecutor.RunGitVersionTool(GitVersionOptions gitVersionOptions) in D:\a\GitVersion\GitVersion\src\GitVersion.App\GitVersionExecutor.cs:line 66 2022-09-08T06:44:51.1783865Z INFO [09/08/22 6:44:51:06] Attempting to show the current git graph (please include in issue): 2022-09-08T06:44:51.1784606Z INFO [09/08/22 6:44:51:06] Showing max of 100 commits 2022-09-08T06:44:51.1785653Z INFO [09/08/22 6:44:51:13] * 42fed85 18 hours ago (grafted, HEAD -> gitversion-error, origin/42fed851e0050dc5227d461cb2fcf1086db89f5b, 42fed851e0050dc5227d461cb2fcf1086db89f5b) 2022-09-08T06:44:51.1786575Z 2022-09-08T06:44:51.1787011Z INFO [09/08/22 6:44:51:15] Done writing 2022-09-08T06:44:51.1830848Z ##[error]SyntaxError: Unexpected end of JSON input 2022-09-08T06:44:51.1848415Z ##[section]Finishing: Execute GitVersion

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:3
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
EwanNoblecommented, Sep 8, 2022

@RichardMays It appears to be an Azure DevOps change, new pipelines are now defaulting to Shallow Fetch = 1 on Github checkouts, if you disable shallow fetch this should unblock you

If you still have your ticket open with Microsoft it might be worth letting them know

1reaction
RichardMayscommented, Sep 8, 2022

@RichardMays It appears to be an Azure DevOps change, new pipelines are now defaulting to Shallow Fetch = 1 on Github checkouts, if you disable shallow fetch this should unblock you

If you still have your ticket open with Microsoft it might be worth letting them know

Awesome, that is it. Thanks for the info, I have now got it to work. I shall drop MS an email back.

Thanks again 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unexpected end of JSON input Error in JavaScript | bobbyhadz
The "Unexpected end of JSON input" error occurs when trying to parse invalid JSON using the JSON.parse or $.parseJSON methods. Trying to parse...
Read more >
Uncaught SyntaxError: Unexpected end of JSON input
A common error encountered by JavaScript programmers is the Uncaught SyntaxError: Unexpected end of JSON input. This is usually observed when the coder...
Read more >
Uncaught SyntaxError: Unexpected end of JSON input at ...
This is because of the data that you are trying to parse is not in a parsable format . so i suggest to...
Read more >
“Unexpected end of JSON input” – possible fixes - LinuxPip
“Unexpected end of JSON input” (or “Uncaught SyntaxError: Unexpected end of JSON input”) is a common error message in JavaScript, ...
Read more >
Fix the unexpected end of input error in JavaScript - Codedamn
One common cause of unexpected end of JSON input error is simply that the JSON data is not well-formed. This means that there...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found