Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,299,406
Community Members
 
Community Events
165
Community Groups

Bitbucket error: Unexpected character encountered while parsing value: <. Path '', line 0, position

We use Atlassian.Stash - C# API wrapper for Atlassian Stash, version v4.0.30319

C# .Net 4.8, Windows 10/1909

We migrated from Bitbucket Server to Bitbucket org, and have the error: Unexpected character encountered while parsing value: <. Path '', line 0, position 0

 try
{
var client = new StashClient(ConfigParametres.GitBaseURL, username, password);
ResponseWrapper<Atlassian.Stash.Entities.Commit> allCommits = await client.Commits.Get("PROJECT_KEY", "REPOSITORY_NAME", null, null);
if (allCommits.Values == null)
{
return false;
}
}
catch (Exception ex)
{
return false;
}

2 answers

0 votes

I solve this issue by removing # and $ characters from my password. 

0 votes

Hi Mark,

Bitbucket Server aka Stash and Bitbucket cloud are 2 different products with 2 completely different REST APIs. Any client written to work with Bitbucket Server will not work as the URL paths will be completely different.

I would expect you will get a 404 not found HTML page as a response which cannot be parsed.

Here is the BBCloud REST API https://developer.atlassian.com/bitbucket/api/2/reference/

I'm not aware of a ready-to use client, but it may be out there.

Hi Ulrich,

 

We used https://github.com/jlouros/StashApiCSharp

Do you know about BBCloud analogue? I mean C# library.

Unfortunately not, Mark.

We switched to another library

https://github.com/lvermeulen/Bitbucket.Cloud.Net

But there is an error when calling GetRepositoryCommitsAsync()

Source "Flurl.Http"

Message "Response could not be deserialized to JSON: GET https://bitbucket.org/2.0/repositories/bxbts/smscore/commits"

InnerException

Source "Newtonsoft.Json"

StackTrace

at Newtonsoft.Json.JsonTextReader.ParseValue()
at Newtonsoft.Json.JsonTextReader.Read()
at Newtonsoft.Json.JsonReader.ReadForType(JsonContract contract, Boolean hasConverter)
at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)
at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)
at Newtonsoft.Json.JsonSerializer.Deserialize[T](JsonReader reader)
at Flurl.Http.Configuration.NewtonsoftJsonSerializer.Deserialize[T](Stream stream)
at Flurl.Http.HttpResponseMessageExtensions.<ReceiveJson>d__0`1.MoveNext()

Message "Unexpected character encountered while parsing value: <. Path '', line 0, position 0." 

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Bitbucket

Git push size limits are coming to Bitbucket Cloud starting April 4th, 2022

Beginning on April 4th, we will be implementing push limits. This means that your push cannot be completed if it is over 3.5 GB. If you do attempt to complete a push that is over 3.5 GB, it will fail...

2,239 views 2 9
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you