Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IIssuesLabelClient.RemoveFromIssue started returning "Error parsing JSON" #1865

Closed
MylioBill opened this issue Sep 6, 2018 · 5 comments · Fixed by #1868
Closed

IIssuesLabelClient.RemoveFromIssue started returning "Error parsing JSON" #1865

MylioBill opened this issue Sep 6, 2018 · 5 comments · Fixed by #1868

Comments

@MylioBill
Copy link

NuGet package v0.31.0

I have code that uses IIssuesLabelClient.RemoveFromIssue(string owner, string name, int number, string labelName)

Everything has been working fine until a couple days ago, when this method started throwing Bad Request 400: Error Parsing JSON API exceptions. This happens on any issue when removing any existing label. Adding labels works fine.

@ryangribble
Copy link
Contributor

Hi @MylioBill I haven't had a chance to attempt to repro this myself yet as I've been on mobile only.

Given there's been no updates I'd guess this is an upstream github API change - the question is whether it's intentional or not.

You said removing existing labels fails but adding labels works. Does adding a label and then trying to remove it, result in the same behaviour?

Out of interest, do these labels in question have emojis in them, or the description field set at all?

@MylioBill
Copy link
Author

Adding a label, then removing it results in the exception. No emojis or descriptions in the labels that have the issue.

@MylioBill
Copy link
Author

Stack info in case it's useful

   at Octokit.Connection.HandleErrors(IResponse response)
   at Octokit.Connection.<RunRequest>d__58.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
   at Octokit.Connection.<Run>d__57`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1.ConfiguredTaskAwaiter.GetResult()
   at Octokit.ApiConnection.<Delete>d__37`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
   at MylioGitHub.GitHub.<RemoveLabelFromIssue>d__23.MoveNext() in C:\Git\Mylio\tools\Github\Triage\Triage\GitHub.cs:line 260
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
   at MylioGitHub.MylioGitHubForm.<ApplyLabels>d__51.MoveNext() in C:\Git\Mylio\tools\Github\Triage\Triage\MylioGitHubForm.cs:line 781
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
   at MylioGitHub.MylioGitHubForm.<BtnApply_Click>d__55.MoveNext() in C:\Git\Mylio\tools\Github\Triage\Triage\MylioGitHubForm.cs:line 836

@ryangribble
Copy link
Contributor

Cool, I found out what the problem is here. Turns out we were accidentally passing a string preview header into the Delete() method as a message body. This has been the case for sometime and been working OK (I ran these integration tests just a few days ago myself) so something on github.com must have changed where it is validating the body of the DELETE request instead of ignoring it as it must have done previously.

Task<T> Delete<T>(Uri uri, object data);

I will put a fix in the next build but in the meantime you could probably use the client.Issue.Update() method to update your issue and remove the label

@MylioBill
Copy link
Author

Using IssueUpdate sidesteps the issue. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants