NullPointer on Api /Items #3099

Closed
opened 2025-12-21 21:38:38 +01:00 by backuprepo · 6 comments
Owner

Originally created by @xmt328 on GitHub (Jun 22, 2021).

Describe the bug
NullPointer on Api /Items

System (please complete the following information):

  • OS: Debian
  • Virtualization: None
  • Clients: Kotlin SDK
  • Browser: None
  • Jellyfin Version: 10.7.6
  • Playback: [Direct Play, Remux, Direct Stream, Transcode]
  • Installed Plugins: Kodi Sync Queue
  • Reverse Proxy: nginx
  • Base URL: [e.g. none, yes: /example]
  • Networking: Host
  • Storage: local

To Reproduce

https://./Items?parentId=1faa9f40-50f8-301e-3006-a036a45cad8d&enableTotalRecordCount=true&enableImages=true

Server Logs

[2021-06-22 09:11:55.276 +08:00] [ERR] Error processing request. URL "GET" "/Items".
System.NullReferenceException: Object reference not set to an instance of an object.
   at Jellyfin.Api.Controllers.ItemsController.GetItems(Nullable`1 userId, String maxOfficialRating, Nullable`1 hasThemeSong, Nullable`1 hasThemeVideo, Nullable`1 hasSubtitles, Nullable`1 hasSpecialFeature, Nullable`1 hasTrailer, String adjacentTo, Nullable`1 parentIndexNumber, Nullable`1 hasParentalRating, Nullable`1 isHd, Nullable`1 is4K, LocationType[] locationTypes, LocationType[] excludeLocationTypes, Nullable`1 isMissing, Nullable`1 isUnaired, Nullable`1 minCommunityRating, Nullable`1 minCriticRating, Nullable`1 minPremiereDate, Nullable`1 minDateLastSaved, Nullable`1 minDateLastSavedForUser, Nullable`1 maxPremiereDate, Nullable`1 hasOverview, Nullable`1 hasImdbId, Nullable`1 hasTmdbId, Nullable`1 hasTvdbId, Guid[] excludeItemIds, Nullable`1 startIndex, Nullable`1 limit, Nullable`1 recursive, String searchTerm, SortOrder[] sortOrder, Nullable`1 parentId, ItemFields[] fields, String[] excludeItemTypes, String[] includeItemTypes, ItemFilter[] filters, Nullable`1 isFavorite, String[] mediaTypes, ImageType[] imageTypes, String[] sortBy, Nullable`1 isPlayed, String[] genres, String[] officialRatings, String[] tags, Int32[] years, Nullable`1 enableUserData, Nullable`1 imageTypeLimit, ImageType[] enableImageTypes, String person, Guid[] personIds, String[] personTypes, String[] studios, String[] artists, Guid[] excludeArtistIds, Guid[] artistIds, Guid[] albumArtistIds, Guid[] contributingArtistIds, String[] albums, Guid[] albumIds, Guid[] ids, VideoType[] videoTypes, String minOfficialRating, Nullable`1 isLocked, Nullable`1 isPlaceHolder, Nullable`1 hasOfficialRating, Nullable`1 collapseBoxSetItems, Nullable`1 minWidth, Nullable`1 minHeight, Nullable`1 maxWidth, Nullable`1 maxHeight, Nullable`1 is3D, SeriesStatus[] seriesStatus, String nameStartsWithOrGreater, String nameStartsWith, String nameLessThan, Guid[] studioIds, Guid[] genreIds, Boolean enableTotalRecordCount, Nullable`1 enableImages)
   at lambda_method934(Closure , Object , Object[] )
   at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.SyncObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeActionMethodAsync()
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeNextActionFilterAsync()
--- End of stack trace from previous location ---
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync()
--- End of stack trace from previous location ---
   at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResourceFilter>g__Awaited|24_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.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
   at Jellyfin.Server.Middleware.ServerStartupMessageMiddleware.Invoke(HttpContext httpContext, IServerApplicationHost serverApplicationHost, ILocalizationManager localizationManager)
   at Jellyfin.Server.Middleware.WebSocketHandlerMiddleware.Invoke(HttpContext httpContext, IWebSocketManager webSocketManager)
   at Jellyfin.Server.Middleware.IpBasedAccessValidationMiddleware.Invoke(HttpContext httpContext, INetworkManager networkManager)
   at Jellyfin.Server.Middleware.LanFilteringMiddleware.Invoke(HttpContext httpContext, INetworkManager networkManager, IServerConfigurationManager serverConfigurationManager)
   at Microsoft.AspNetCore.Authorization.Policy.AuthorizationMiddlewareResultHandler.HandleAsync(RequestDelegate next, HttpContext context, AuthorizationPolicy policy, PolicyAuthorizationResult authorizeResult)
   at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
   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.Server.Middleware.RobotsRedirectionMiddleware.Invoke(HttpContext httpContext)
   at Jellyfin.Server.Middleware.LegacyEmbyRouteRewriteMiddleware.Invoke(HttpContext httpContext)
   at Microsoft.AspNetCore.ResponseCompression.ResponseCompressionMiddleware.Invoke(HttpContext context)
   at Jellyfin.Server.Middleware.ResponseTimeMiddleware.Invoke(HttpContext context)
   at Jellyfin.Server.Middleware.ExceptionMiddleware.Invoke(HttpContext context)

Originally created by @xmt328 on GitHub (Jun 22, 2021). **Describe the bug** NullPointer on Api /Items **System (please complete the following information):** - OS: Debian - Virtualization: None - Clients: Kotlin SDK - Browser: None - Jellyfin Version: 10.7.6 - Playback: [Direct Play, Remux, Direct Stream, Transcode] - Installed Plugins: Kodi Sync Queue - Reverse Proxy: nginx - Base URL: [e.g. none, yes: /example] - Networking: Host - Storage: local **To Reproduce** https://*.*/Items?parentId=1faa9f40-50f8-301e-3006-a036a45cad8d&enableTotalRecordCount=true&enableImages=true **Server Logs** ``` [2021-06-22 09:11:55.276 +08:00] [ERR] Error processing request. URL "GET" "/Items". System.NullReferenceException: Object reference not set to an instance of an object. at Jellyfin.Api.Controllers.ItemsController.GetItems(Nullable`1 userId, String maxOfficialRating, Nullable`1 hasThemeSong, Nullable`1 hasThemeVideo, Nullable`1 hasSubtitles, Nullable`1 hasSpecialFeature, Nullable`1 hasTrailer, String adjacentTo, Nullable`1 parentIndexNumber, Nullable`1 hasParentalRating, Nullable`1 isHd, Nullable`1 is4K, LocationType[] locationTypes, LocationType[] excludeLocationTypes, Nullable`1 isMissing, Nullable`1 isUnaired, Nullable`1 minCommunityRating, Nullable`1 minCriticRating, Nullable`1 minPremiereDate, Nullable`1 minDateLastSaved, Nullable`1 minDateLastSavedForUser, Nullable`1 maxPremiereDate, Nullable`1 hasOverview, Nullable`1 hasImdbId, Nullable`1 hasTmdbId, Nullable`1 hasTvdbId, Guid[] excludeItemIds, Nullable`1 startIndex, Nullable`1 limit, Nullable`1 recursive, String searchTerm, SortOrder[] sortOrder, Nullable`1 parentId, ItemFields[] fields, String[] excludeItemTypes, String[] includeItemTypes, ItemFilter[] filters, Nullable`1 isFavorite, String[] mediaTypes, ImageType[] imageTypes, String[] sortBy, Nullable`1 isPlayed, String[] genres, String[] officialRatings, String[] tags, Int32[] years, Nullable`1 enableUserData, Nullable`1 imageTypeLimit, ImageType[] enableImageTypes, String person, Guid[] personIds, String[] personTypes, String[] studios, String[] artists, Guid[] excludeArtistIds, Guid[] artistIds, Guid[] albumArtistIds, Guid[] contributingArtistIds, String[] albums, Guid[] albumIds, Guid[] ids, VideoType[] videoTypes, String minOfficialRating, Nullable`1 isLocked, Nullable`1 isPlaceHolder, Nullable`1 hasOfficialRating, Nullable`1 collapseBoxSetItems, Nullable`1 minWidth, Nullable`1 minHeight, Nullable`1 maxWidth, Nullable`1 maxHeight, Nullable`1 is3D, SeriesStatus[] seriesStatus, String nameStartsWithOrGreater, String nameStartsWith, String nameLessThan, Guid[] studioIds, Guid[] genreIds, Boolean enableTotalRecordCount, Nullable`1 enableImages) at lambda_method934(Closure , Object , Object[] ) at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.SyncObjectResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeActionMethodAsync() at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeNextActionFilterAsync() --- End of stack trace from previous location --- at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.InvokeInnerFilterAsync() --- End of stack trace from previous location --- at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResourceFilter>g__Awaited|24_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.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger) at Jellyfin.Server.Middleware.ServerStartupMessageMiddleware.Invoke(HttpContext httpContext, IServerApplicationHost serverApplicationHost, ILocalizationManager localizationManager) at Jellyfin.Server.Middleware.WebSocketHandlerMiddleware.Invoke(HttpContext httpContext, IWebSocketManager webSocketManager) at Jellyfin.Server.Middleware.IpBasedAccessValidationMiddleware.Invoke(HttpContext httpContext, INetworkManager networkManager) at Jellyfin.Server.Middleware.LanFilteringMiddleware.Invoke(HttpContext httpContext, INetworkManager networkManager, IServerConfigurationManager serverConfigurationManager) at Microsoft.AspNetCore.Authorization.Policy.AuthorizationMiddlewareResultHandler.HandleAsync(RequestDelegate next, HttpContext context, AuthorizationPolicy policy, PolicyAuthorizationResult authorizeResult) at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context) 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.Server.Middleware.RobotsRedirectionMiddleware.Invoke(HttpContext httpContext) at Jellyfin.Server.Middleware.LegacyEmbyRouteRewriteMiddleware.Invoke(HttpContext httpContext) at Microsoft.AspNetCore.ResponseCompression.ResponseCompressionMiddleware.Invoke(HttpContext context) at Jellyfin.Server.Middleware.ResponseTimeMiddleware.Invoke(HttpContext context) at Jellyfin.Server.Middleware.ExceptionMiddleware.Invoke(HttpContext context) ```
backuprepo 2025-12-21 21:38:38 +01:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@dkanada commented on GitHub (Jun 22, 2021):

Are you passing the API key anywhere?

@dkanada commented on GitHub (Jun 22, 2021): Are you passing the API key anywhere?
Author
Owner

@xmt328 commented on GitHub (Jun 22, 2021):

Are you passing the API key anywhere?

Yes, and I'm using jellyfin-sdk-kotlin

    val jellyfin = Jellyfin {
        clientInfo = ClientInfo("Jellyfin CLI", "DEV")
        deviceInfo = DeviceInfo("developer", "developer")
    }

    val api = jellyfin.createApi(baseUrl = server, accessToken = "xxxxxxxxxx")
    val session = SessionApi(api).getSessions().content.firstOrNull()
    api.userId = session?.userId
@xmt328 commented on GitHub (Jun 22, 2021): > Are you passing the API key anywhere? Yes, and I'm using [jellyfin-sdk-kotlin](https://github.com/jellyfin/jellyfin-sdk-kotlin) ```kotlin val jellyfin = Jellyfin { clientInfo = ClientInfo("Jellyfin CLI", "DEV") deviceInfo = DeviceInfo("developer", "developer") } val api = jellyfin.createApi(baseUrl = server, accessToken = "xxxxxxxxxx") val session = SessionApi(api).getSessions().content.firstOrNull() api.userId = session?.userId ```
Author
Owner

@dkanada commented on GitHub (Jun 22, 2021):

Have you tried it with a user ID? The API has lots of inconsistencies in that regard at the moment, so it might be required.

@dkanada commented on GitHub (Jun 22, 2021): Have you tried it with a user ID? The API has lots of inconsistencies in that regard at the moment, so it might be required.
Author
Owner

@xmt328 commented on GitHub (Jun 22, 2021):

Have you tried it with a user ID? The API has lots of inconsistencies in that regard at the moment, so it might be required.

I have tried to use /Users/{userId}/Items, and pass userId to /Items

they are both worked.

@xmt328 commented on GitHub (Jun 22, 2021): > Have you tried it with a user ID? The API has lots of inconsistencies in that regard at the moment, so it might be required. I have tried to use /Users/{userId}/Items, and pass userId to /Items they are both worked.
Author
Owner

@nielsvanvelzen commented on GitHub (Jun 22, 2021):

Some tips:

  • When authenticating using the API with for example AuthenticateUserByName you can get the user id from that response, no need for the sessions call
  • When using the ItemsApi use the GetItemsByUserId function instead of GetItems. They both use the exact same code path in the server but the second one marks the user id (wrongly) as nullable and the SDK won't automatically fill it in.
@nielsvanvelzen commented on GitHub (Jun 22, 2021): Some tips: - When authenticating using the API with for example AuthenticateUserByName you can get the user id from that response, no need for the sessions call - When using the ItemsApi use the `GetItemsByUserId` function instead of `GetItems`. They both use the exact same code path in the server but the second one marks the user id (wrongly) as nullable and the SDK won't automatically fill it in.
Author
Owner

@cvium commented on GitHub (Jun 22, 2021):

Seems like this has been "resolved". It's also a duplicate of https://github.com/jellyfin/jellyfin/issues/2246.

@cvium commented on GitHub (Jun 22, 2021): Seems like this has been "resolved". It's also a duplicate of https://github.com/jellyfin/jellyfin/issues/2246.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: starred/jellyfin#3099
No description provided.