Allow image cleanup #7095

Closed
opened 2026-02-07 04:33:02 +03:00 by OVERLORD · 5 comments
Owner

Originally created by @enter-a-random-username on GitHub (Jun 13, 2025).

Description of the bug

Some person/people are without an image. (It seems anidb wants an image, but it can't be loaded). If I click the trash bin I get an exception. Only way to fix it so far, is to overwrite it with another metadata provider → No other image is no possible fix without altering the DB.

Trying uploading a new image

URL POST /Items/<hash>/Images/Primary.
System.ArgumentException: The value cannot be an empty string. (Parameter 'path')

Deleting the image (rest f the log in in the log section)

URL DELETE /Items/<hash>/Images/Primary.   
System.ArgumentException: The value cannot be an empty string. (Parameter 'path')

Reproduction steps

  1. Find a missing image with a primary entity id
  2. Try to remove or overwrite it

What is the current bug behavior?

  1. Every API action uses a function that wants to check for the image and throws an exception

What is the expected correct behavior?

  • Cleanup the DB in a task
  • or let me delete a problem entry if file exsits is false -> skip the delete

Jellyfin Server version

Master

Specify commit id

23c2528

Specify unstable release number

No response

Specify version number

No response

Specify the build version

10.11.0

Environment

- OS:
- Linux Kernel:
- Virtualization:
- Clients:
- Browser:
- FFmpeg Version:
- Playback Method:
- Hardware Acceleration:
- GPU Model:
- Plugins:
- Reverse Proxy:
- Base URL:
- Networking:
- Jellyfin Data Storage:
- Media Storage:
- External Integrations:

Jellyfin logs

[ERR] [74] Jellyfin.Api.Middleware.ExceptionMiddleware: Error processing request. URL DELETE /Items/74f42d492c0304fc90e93e800bd74045/Images/Primary.
System.ArgumentException: The value cannot be an empty string. (Parameter 'path')
   at System.ArgumentException.ThrowNullOrEmptyException(String argument, String paramName)
   at System.IO.Path.GetFullPath(String path)
   at System.IO.File.Delete(String path)
   at Emby.Server.Implementations.IO.ManagedFileSystem.DeleteFile(String path)
   at MediaBrowser.Controller.Entities.BaseItem.DeleteImageAsync(ImageType type, Int32 index)
   at Jellyfin.Api.Controllers.ImageController.DeleteItemImage(Guid itemId, ImageType imageType, Nullable`1 imageIndex)
   at lambda_method7993(Closure, Object)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.TaskOfActionResultExecutor.Execute(ActionContext actionContext, IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync()
--- End of stack trace from previous location ---
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResourceFilter>g__Awaited|25_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeFilterPipelineAsync()
--- End of stack trace from previous location ---
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope)
   at Jellyfin.Api.Middleware.ServerStartupMessageMiddleware.Invoke(HttpContext httpContext, IServerApplicationHost serverApplicationHost, ILocalizationManager localizationManager)
   at Jellyfin.Api.Middleware.WebSocketHandlerMiddleware.Invoke(HttpContext httpContext, IWebSocketManager webSocketManager)
   at Jellyfin.Api.Middleware.IPBasedAccessValidationMiddleware.Invoke(HttpContext httpContext, INetworkManager networkManager)
   at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
   at Jellyfin.Api.Middleware.QueryStringDecodingMiddleware.Invoke(HttpContext httpContext)
   at Swashbuckle.AspNetCore.ReDoc.ReDocMiddleware.Invoke(HttpContext httpContext)
   at Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIMiddleware.Invoke(HttpContext httpContext)
   at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext, ISwaggerProvider swaggerProvider)
   at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
   at Jellyfin.Api.Middleware.LegacyEmbyRouteRewriteMiddleware.Invoke(HttpContext httpContext)
   at Jellyfin.Api.Middleware.ResponseTimeMiddleware.Invoke(HttpContext context, IServerConfigurationManager serverConfigurationManager)
   at Jellyfin.Api.Middleware.ExceptionMiddleware.Invoke(HttpContext context)

FFmpeg logs


Client / Browser logs

No response

Relevant screenshots or videos

No response

Additional information

No response

Originally created by @enter-a-random-username on GitHub (Jun 13, 2025). ### Description of the bug Some person/people are without an image. (It seems anidb wants an image, but it can't be loaded). If I click the trash bin I get an exception. Only way to fix it so far, is to overwrite it with another metadata provider → No other image is no possible fix without altering the DB. Trying uploading a new image ``` URL POST /Items/<hash>/Images/Primary. System.ArgumentException: The value cannot be an empty string. (Parameter 'path') ``` Deleting the image (rest f the log in in the log section) ``` URL DELETE /Items/<hash>/Images/Primary. System.ArgumentException: The value cannot be an empty string. (Parameter 'path') ``` ### Reproduction steps 1. Find a missing image with a primary entity id 2. Try to remove or overwrite it ### What is the current _bug_ behavior? 1. Every API action uses a function that wants to check for the image and throws an exception ### What is the expected _correct_ behavior? - Cleanup the DB in a task - or let me delete a problem entry `if file exsits is false -> skip the delete` ### Jellyfin Server version Master ### Specify commit id 23c2528 ### Specify unstable release number _No response_ ### Specify version number _No response_ ### Specify the build version 10.11.0 ### Environment ```markdown - OS: - Linux Kernel: - Virtualization: - Clients: - Browser: - FFmpeg Version: - Playback Method: - Hardware Acceleration: - GPU Model: - Plugins: - Reverse Proxy: - Base URL: - Networking: - Jellyfin Data Storage: - Media Storage: - External Integrations: ``` ### Jellyfin logs ```shell [ERR] [74] Jellyfin.Api.Middleware.ExceptionMiddleware: Error processing request. URL DELETE /Items/74f42d492c0304fc90e93e800bd74045/Images/Primary. System.ArgumentException: The value cannot be an empty string. (Parameter 'path') at System.ArgumentException.ThrowNullOrEmptyException(String argument, String paramName) at System.IO.Path.GetFullPath(String path) at System.IO.File.Delete(String path) at Emby.Server.Implementations.IO.ManagedFileSystem.DeleteFile(String path) at MediaBrowser.Controller.Entities.BaseItem.DeleteImageAsync(ImageType type, Int32 index) at Jellyfin.Api.Controllers.ImageController.DeleteItemImage(Guid itemId, ImageType imageType, Nullable`1 imageIndex) at lambda_method7993(Closure, Object) at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.TaskOfActionResultExecutor.Execute(ActionContext actionContext, IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync() --- End of stack trace from previous location --- at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResourceFilter>g__Awaited|25_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context) at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.InvokeFilterPipelineAsync() --- End of stack trace from previous location --- at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope) at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Awaited|17_0(ResourceInvoker invoker, Task task, IDisposable scope) at Jellyfin.Api.Middleware.ServerStartupMessageMiddleware.Invoke(HttpContext httpContext, IServerApplicationHost serverApplicationHost, ILocalizationManager localizationManager) at Jellyfin.Api.Middleware.WebSocketHandlerMiddleware.Invoke(HttpContext httpContext, IWebSocketManager webSocketManager) at Jellyfin.Api.Middleware.IPBasedAccessValidationMiddleware.Invoke(HttpContext httpContext, INetworkManager networkManager) at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context) at Jellyfin.Api.Middleware.QueryStringDecodingMiddleware.Invoke(HttpContext httpContext) at Swashbuckle.AspNetCore.ReDoc.ReDocMiddleware.Invoke(HttpContext httpContext) at Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIMiddleware.Invoke(HttpContext httpContext) at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext, ISwaggerProvider swaggerProvider) at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context) at Jellyfin.Api.Middleware.LegacyEmbyRouteRewriteMiddleware.Invoke(HttpContext httpContext) at Jellyfin.Api.Middleware.ResponseTimeMiddleware.Invoke(HttpContext context, IServerConfigurationManager serverConfigurationManager) at Jellyfin.Api.Middleware.ExceptionMiddleware.Invoke(HttpContext context) ``` ### FFmpeg logs ```shell ``` ### Client / Browser logs _No response_ ### Relevant screenshots or videos _No response_ ### Additional information _No response_
OVERLORD added the bug label 2026-02-07 04:33:02 +03:00
Author
Owner

@Shadowghost commented on GitHub (Jun 13, 2025):

Just to make sure I understand it correctly: Somehow the provider creates an Image entry in the DB but no actual file on the drive, so now it fails to delete the bad entry if you do it manually?

@Shadowghost commented on GitHub (Jun 13, 2025): Just to make sure I understand it correctly: Somehow the provider creates an Image entry in the DB but no actual file on the drive, so now it fails to delete the bad entry if you do it manually?
Author
Owner

@enter-a-random-username commented on GitHub (Jun 13, 2025):

Just to make sure I understand it correctly: Somehow the provider creates an Image entry in the DB but no actual file on the drive, so now it fails to delete the bad entry if you do it manually?

I think it was/is a bug in anidb or API change or so. Metadata works and I have no 0 byte XML in cache.

Image

[ERR] [82] Jellyfin.Api.Controllers.ImageController: Error getting image information for Y
System.ArgumentException: The value cannot be an empty string. (Parameter 'path')

Selection

Image

URL

Image

Writer has an image on anidb. In general, it seems the mapping to person has some issues at the moment. I don't see any links to anidb. Can't remember

@enter-a-random-username commented on GitHub (Jun 13, 2025): > Just to make sure I understand it correctly: Somehow the provider creates an Image entry in the DB but no actual file on the drive, so now it fails to delete the bad entry if you do it manually? I think it was/is a bug in anidb or API change or so. Metadata works and I have no 0 byte XML in cache. ![Image](https://github.com/user-attachments/assets/fb6d7ea9-e74e-47ee-a6c7-630ef1b2e59f) ``` [ERR] [82] Jellyfin.Api.Controllers.ImageController: Error getting image information for Y System.ArgumentException: The value cannot be an empty string. (Parameter 'path') ``` Selection ![Image](https://github.com/user-attachments/assets/1b93aabc-4e8a-484a-ba17-f8d90a8486af) URL ![Image](https://github.com/user-attachments/assets/7aee048a-cb4a-4a60-9cb7-a8bdb11178a7) Writer has an image on anidb. In general, it seems the mapping to person has some issues at the moment. I don't see any links to anidb. Can't remember
Author
Owner

@sjorge commented on GitHub (Jun 14, 2025):

0 byte XML is probably because it tried to download one when the client was ratelimited. I think a while ago there was an attempt to fix this, but I think there are still edge cases where you can end up with a invalid XML in the cache.

Edit, hmm just a match on the banned XML payload I think, not when you keep going and it just refuses to reply.
7a29589b59 is already 3 years old.

Wouldn't surprise me some bogus/bad date got send to jellyfin and somepoint that now shows it's ugly head after the conversion to EFCore.

@sjorge commented on GitHub (Jun 14, 2025): 0 byte XML is probably because it tried to download one when the client was ratelimited. I think a while ago there was an attempt to fix this, but I think there are still edge cases where you can end up with a invalid XML in the cache. Edit, hmm just a match on the banned XML payload I think, not when you keep going and it just refuses to reply. https://github.com/jellyfin/jellyfin-plugin-anidb/commit/7a29589b59366db1764179d72912352614e31393 is already 3 years old. Wouldn't surprise me some bogus/bad date got send to jellyfin and somepoint that now shows it's ugly head after the conversion to EFCore.
Author
Owner

@enter-a-random-username commented on GitHub (Jun 14, 2025):

0 byte XML is probably because it tried to download one when the client was ratelimited. I think a while ago there was an attempt to fix this, but I think there are still edge cases where you can end up with a invalid XML in the cache.

Edit, hmm just a match on the banned XML payload I think, not when you keep going and it just refuses to reply. jellyfin/jellyfin-plugin-anidb@7a29589 is already 3 years old.

Wouldn't surprise me some bogus/bad date got send to jellyfin and somepoint that now shows it's ugly head after the conversion to EFCore.

What? I wrote NO 0 byte, so that is not the issue.
That is not the issue with missing images, everything else loads. Even images for show, only person fails.
I didn't report anything because that repo is not very active and complicated with UDP API and XML HTTP limited. I clean up the 0 byte files and restart the process 12 h later or so. It works. Unrelated to this.

@enter-a-random-username commented on GitHub (Jun 14, 2025): > 0 byte XML is probably because it tried to download one when the client was ratelimited. I think a while ago there was an attempt to fix this, but I think there are still edge cases where you can end up with a invalid XML in the cache. > > Edit, hmm just a match on the banned XML payload I think, not when you keep going and it just refuses to reply. [jellyfin/jellyfin-plugin-anidb@7a29589](https://github.com/jellyfin/jellyfin-plugin-anidb/commit/7a29589b59366db1764179d72912352614e31393) is already 3 years old. > > Wouldn't surprise me some bogus/bad date got send to jellyfin and somepoint that now shows it's ugly head after the conversion to EFCore. What? I wrote **NO** 0 byte, so that is not the issue. That is not the issue with missing images, everything else loads. Even images for show, only person fails. I didn't report anything because that repo is not very active and complicated with UDP API and XML HTTP limited. I clean up the 0 byte files and restart the process 12 h later or so. It works. Unrelated to this.
Author
Owner

@sjorge commented on GitHub (Jun 14, 2025):

Sorry, my brain skipped over the NO.

@sjorge commented on GitHub (Jun 14, 2025): Sorry, my brain skipped over the *NO*.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/jellyfin#7095