mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-05-04 18:09:12 +03:00
[Issue]: Updating tags with API fails and corrupts item until rescan #5314
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @danieldietsch on GitHub (Dec 14, 2023).
Please describe your bug
I am trying to write a small script to update tags of various items, in particular TV shows.
Using POST to /Items/{item_id} with JSON payload
{"Tags": ["SomeTag"]}results in 400 response andJellyfin.Server.Middleware.ExceptionMiddleware: Error processing request. URL POST /Items/<item_id>. System.ArgumentNullException: Value cannot be null. (Parameter 'source').Afterwards, the TV show cannot be accessed anymore (e.g.,
GET /Users/<userid>/Items/<itemid>also yieldsSystem.ArgumentNullException: Value cannot be null. (Parameter 'source')).Rescanning the library fixes this, but the tag has not been added.
Jellyfin Version
10.8.z
if other:
No response
Environment
Jellyfin logs
FFmpeg logs
No response
Please attach any browser or client logs here
No response
Please attach any screenshots here
No response
Code of Conduct
@Erotemic commented on GitHub (Jan 2, 2024):
I think I'm also having a similar issue.
I want to programatically update some metadata. I have a MWE:
replace
MY_TOKEN_VALUEwith an access token and replaceMY_ITEM_IDwith an item id in your library (it seems like the dashes in the UUID might matter? Not 100% sure on that). Then in the json body I'm just setting the "OriginalTitle" field to "Foobar" as a test.Before I run this I can click the item and look at it in the web browser. After I run the curl command I get:
And then if I click the item in the browser again it locks up and just gives a spinning circle.
But if I open a new page, and rescan the library the item is accessable again (although the metadata has not been updated).
On the sever, running
journalctl -u jellyfin.serviceI see similar error messages as the original issue, with the imporant error seeming to be:System.ArgumentNullException: Value cannot be null. (Parameter 'source').Full output in details:
Software Info:
@Erotemic commented on GitHub (Jan 3, 2024):
@danieldietsch After debugging with folks in the matrix chat, I think I found the issue.
The null exception is from: https://github.com/jellyfin/jellyfin/blob/release-10.8.z/Jellyfin.Api/Controllers/ItemUpdateController.cs#L303
The ItemUpdate POST to
POST to /Items/{item_id}requires that you pass ALL of the information to it. Anything you don't pass is nulled. From @nielsvanvelzen in the chat:I did this via the Python API:
@jellyfin-bot commented on GitHub (May 2, 2024):
This issue has gone 120 days without an update and will be closed within 21 days if there is no new activity. To prevent this issue from being closed, please confirm the issue has not already been fixed by providing updated examples or logs.
If you have any questions you can use one of several ways to contact us.
@Erotemic commented on GitHub (May 2, 2024):
I don't think this has been fixed yet. I think an actual fix will be hard without breaking backwards compatibility, but at the very least some notes should be added to the API documentation.
@nielsvanvelzen commented on GitHub (May 2, 2024):
We've discussed this in chat and determined this is not a bug. The API was intentionally designed to receive the complete item data.
A pull request to add a note about this behavior to the API would be accepted.
@lrsvmb commented on GitHub (Jun 28, 2025):
For anyone wondering how to achieve that in the
typescript-sdk, you'll need to include ALL the fields:Then you can update the tags: