Getting Sprint Issues return SyntaxError: Unexpected token < in JSON at position 0


When I use the below REST API to query the issues in a specific sprint, there is an error returned:
SyntaxError: Unexpected token < in JSON at position 0

Anyone knows the possible reason why certian Jira Cloud sites get that error? Thanks.

BTW, the sites may be migrared from on-premise to Cloud.

NOTE: The execution time for this API call is 20 seconds.

      const response = await api 
        .requestJira(route `/rest/agile/1.0/sprint/${SprintId}/issue?startAt=${startAt}&maxResults=${maxResults}&fields=assignee,${storyPointFieldId},statuscategorychangedate,status`);
      const data = await response.json();


Hi @YY1 ,

This looks very much like HTML being returned when you’re expecting a JSON response. That why the response.json() call fails. Most of the times when I encountered something like this, it turned out to be an authentication error, but it could also be something else.

I would suggest you change the last line to something like this and check what’s actually being returned:

const data = await response.text();

Hope that helps,

Thanks for your reply @osiebenmarck

There’s a background: accoridng to the logs, for most of customer sites, that code works as expected. But only for 2 sites, the issue will occur.

Hi @YY1 ,

Without the exact error message, there really isn’t a way to know for sure what’s going on. However, if I were to venture a guess, then maybe the sites that show the error do not include Jira Software? If I remember correctly, Jira Work Management does not include Sprints.



Hi, I got the same error. I’ve found that this happens at least with:


So, all of them refers to /rest/agile/1.0

I don’t know how to rid off of them. Have you found a solution?

I asked Atlassian support for help and they mentioned rate limiting for certian customers. I haven’t resolved it, but we can try to resolve it together. Please see Rate limiting Response handling pseudo code - #5 by dmorrow @veloti

BTW, how do you get that observation or conclusion that all the 6 REST APIs have this issue? May I know if your Jira instance is migrated from on-premise Jira (e.g. Server or Data Center)?

No, my Jira wasn’t migrated. About the observation, we are developing a cloud app on Forge and tried to figure out where the errors come from in the console.

Hi @veloti!

One issue to be aware of with Jira Software-specific APIs is that they do typically require additional scopes, not the typical read:jira-work scopes required by most other APIs.

For example, /rest/agile/1.0/board requires read:board-scope:jira-software and read:issue-details:jira as per

@veloti & @YY1 if you’re seeing this issue for only a subset of Jira Cloud sites that your app is installed into, or you’re otherwise unable to resolve the issue, please raise an support request under the Report a bug category in our ECOHELP service desk with more specifics about your apps & Jira sites and our Developer Support team will endeavour to assist you.


Thanks @tpettersen I’ve raised one and got suggestion to add rate limiting logic. I’m struggling with the suggested solution now. Jira Service Management