API: POST /search/random returns internal server error #4433

Closed
opened 2026-02-05 10:22:38 +03:00 by OVERLORD · 0 comments
Owner

Originally created by @JW-CH on GitHub (Sep 28, 2024).

The bug

https://demo.immich.app/doc#/Search/searchRandom

calling the POST /search/random endpoint with parameters like withExif or personIds returns an internal server error

The OS that Immich Server is running on

Unraid

Version of Immich Server

v1.116

Version of Immich Mobile App

Platform with the issue

  • Server
  • Web
  • Mobile

Your docker-compose.yml content

not needed

Your .env content

not needed

Reproduction steps

  1. Go to https://demo.immich.app/doc#/Search/searchRandom (make sure you are logged in)
  2. use request body:
{
  "withExif": true,
  "page": 1,
  "size": 100
}
  1. Execute

Relevant log output

Immich Logs:
ERROR [Api:ErrorInterceptor~2tquej6l] Database error: QueryFailedError: for SELECT DISTINCT, ORDER BY expressions must appear in select list


Server Response:
Error: response status is 500

{
  "message": "Failed to search random",
  "error": "Internal Server Error",
  "statusCode": 500,
  "correlationId": "p93x6n1q"
}

Additional information

curl -X 'POST' \
  'https://demo.immich.app/api/search/random' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
  "withExif": true,
  "page": 1,
  "size": 100
}'
Originally created by @JW-CH on GitHub (Sep 28, 2024). ### The bug https://demo.immich.app/doc#/Search/searchRandom calling the `POST /search/random` endpoint with parameters like `withExif` or `personIds` returns an internal server error ### The OS that Immich Server is running on Unraid ### Version of Immich Server v1.116 ### Version of Immich Mobile App - ### Platform with the issue - [X] Server - [ ] Web - [ ] Mobile ### Your docker-compose.yml content ```YAML not needed ``` ### Your .env content ```Shell not needed ``` ### Reproduction steps 1. Go to https://demo.immich.app/doc#/Search/searchRandom (make sure you are logged in) 2. use request body: ``` { "withExif": true, "page": 1, "size": 100 } ``` 3. Execute ### Relevant log output ```shell Immich Logs: ERROR [Api:ErrorInterceptor~2tquej6l] Database error: QueryFailedError: for SELECT DISTINCT, ORDER BY expressions must appear in select list Server Response: Error: response status is 500 { "message": "Failed to search random", "error": "Internal Server Error", "statusCode": 500, "correlationId": "p93x6n1q" } ``` ### Additional information ``` curl -X 'POST' \ 'https://demo.immich.app/api/search/random' \ -H 'accept: application/json' \ -H 'Content-Type: application/json' \ -d '{ "withExif": true, "page": 1, "size": 100 }' ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: immich-app/immich#4433