Trying to add a collection to a movie via PUT ends in 'bad lexical cast: source type value could not be interpreted as target' error

I am trying to get this script to work: https://github.com/mza921/Plex-Auto-Collections
It adds collections to movies for you. The script crashes at the very first movie with a BadRequest: (500) error. It tries to add the collection with this request

http://10.0.0.2:32400/library/sections/None/all?collection%5B0%5D.tag.tag=Comedy&collection.locked=1&id=13141&type=1&X-Plex-Token=XXXXXXXXXXX

Plex logs the following error:

Exception handled: bad lexical cast: source type value could not be interpreted as target

I could recreate the behaviour with Postman, each time I send the PUT request the error is logged and I get a 500 response.

Is the request correct? If yes, what does the error mean and how do I get rid of it?

Thanks!

Would be really grateful for any tips how to get rid of this error since I cannot wait to use that script.

Turns out that the x-token I used for the requests was old and it somehow changed without me noticing. Using a fresh token fixes the problem :slight_smile:

1 Like