Announcements

Help Wizard

Step 1

NEXT STEP

FAQs

Please see below the most popular frequently asked questions.

Loading article...

Loading faqs...

VIEW ALL

Ongoing Issues

Please see below the current ongoing issues which are under investigation.

Loading issue...

Loading ongoing issues...

VIEW ALL

CreatePlaylist -> Http 500, "message": "com.schibsted.spt.data.jslt.JsltException..."

Solved!

CreatePlaylist -> Http 500, "message": "com.schibsted.spt.data.jslt.JsltException..."

Plan

Free

Country

Poland

 

Operating System

( Windows 10)

 

My Question or Issue

I found the cause of the error. The issue was in the request body: I passed the `name` field as a number instead of a string.

Here’s the problematic payload:

 

maraby777_0-1743692079601.png

 

 

--header 'Content-Type: application/json'\
--header 'Authorization: Bearer {{access_token}}.' \
--data '{
  "name": 1,
  "description": "A playlist created for testing",
  "public": false
}'


Actual result:

Response:

{
    "error": {
        "status": 500,
        "message": "com.schibsted.spt.data.jslt.JsltException: Function size() cannot work on 1"
    }
}
 
Expected result: 
{
"error": {
"status": 400,
"message": "Invalid data type: 'name' must be a string."
}
}
 
=========

And here’s the corrected version:

{
"name": "1",
"description": "Test playlist",
"public": false
}
Once I changed "name": 1 to "name": "1", the 500 error disappeared, and the playlist was created successfully.

 

 

 

Reply

Accepted Solutions
Marked as solution

Hi @Ximzend

Thanks for your response!

In this case, the issue wasn't caused by an invalid token or missing scopes.
The access token was valid, and I had the correct `playlist-modify-public` and `playlist-modify-private` scopes.

The actual problem was a wrong data type in the request body - I passed `name` as a number instead of a string.
So this was more of a server-side validation issue: the API returned a 500 Internal Server Error, even though a 400 Bad Request with a validation message would have been more appropriate.

Unfortunately, I couldn't find any official way to report this finding directly to the Spotify developer team, so I’m leaving it here in case someone from the team sees it or if it helps someone else experiencing the same issue 🙂

Thanks again!

Nat.

 

View solution in original post

2 Replies

Hi @maraby777 

Thank you for posting in the Spotify Community, and Welcome!

 

I understand you are trying to create a playlist using Postman.

The issue may be that you are using the first token you generated when going through the first tutorial. In that case, you need to continue with "The authorization guide provides detailed information about which authorization flow suits you best. Make sure you read it first!", as located at the bottom of that page under "What's next".

One heads-up: every endpoint that accesses or changes user data has their own scopes. You can find the authorisation scopes at the top of every endpoint documentation that has that kind of functionality.

 

Good luck with your project, and feel free to ask more questions.

XimzendSpotify Star
Help others find this answer and click "Accept as Solution".
If you appreciate my answer, maybe give me a Like.
Note: I'm not a Spotify employee.
Marked as solution

Hi @Ximzend

Thanks for your response!

In this case, the issue wasn't caused by an invalid token or missing scopes.
The access token was valid, and I had the correct `playlist-modify-public` and `playlist-modify-private` scopes.

The actual problem was a wrong data type in the request body - I passed `name` as a number instead of a string.
So this was more of a server-side validation issue: the API returned a 500 Internal Server Error, even though a 400 Bad Request with a validation message would have been more appropriate.

Unfortunately, I couldn't find any official way to report this finding directly to the Spotify developer team, so I’m leaving it here in case someone from the team sees it or if it helps someone else experiencing the same issue 🙂

Thanks again!

Nat.

 

Suggested posts