[Bug] Python Client Crash: AssetResponseDto fails on missing 'height' or 'width' fields in search_metadata #8359

Closed
opened 2026-02-05 13:41:12 +03:00 by OVERLORD · 0 comments
Owner

Originally created by @Joshua-Wise78 on GitHub (Jan 30, 2026).

I have searched the existing issues, both open and closed, to make sure this is not a duplicate report.

  • Yes

The bug

Using the generated Python client from openAPI. When calling search_metadata the client crashes with the key error of, KeyError: 'height' for certain assets.

OpenAPI defines the height and width as required integer fields for the AssetResponseDto. However sometimes the return asset objects where these keys are completely missing not just null but absent from JSON.

The OS that Immich Server is running on

MacOS/Ubuntu

Version of Immich Server

v2.4.1

Version of Immich Mobile App

N/A

Platform with the issue

  • Server
  • Web
  • Mobile

Device make and model

Macbook M4 & Home Server

Your docker-compose.yml content

N/A

Your .env content

N/A

Reproduction steps

  1. Generate Python API using latest OpenAPI spec
  2. Perform a search_metadata call that returns a mix of assets (Specifically ones that might be missing something or just generally older)
  3. The client raises a KeyError when parsing the response
    ...

Relevant log output

Inside immich_client/models/asset_response_dto.py

inside from_dict method

height = d.pop("height")
width = d.pop("width")


File "immich_client/api/search/search_metadata.py", line XX, in _parse_response
    return AssetResponseDto.from_dict(data)
File "immich_client/models/asset_response_dto.py", line 226, in from_dict
    height = d.pop("height")
KeyError: 'height'

Expected:
- Marking them as Optional/Null by default or 0 or None if missing

Actual:
- Client enforces the strict requirements from the spec and crashes upon receiving a response that omits these fields.

Additional information

The manual fix I implemented

height = d.pop("height", None)
width = d.pop("width", None)

Please reach out I can send more code snippets from my actual code that raised these errors. Maybe I was interacting with something incorrectly.

Originally created by @Joshua-Wise78 on GitHub (Jan 30, 2026). ### I have searched the existing issues, both open and closed, to make sure this is not a duplicate report. - [x] Yes ### The bug Using the generated Python client from openAPI. When calling `search_metadata` the client crashes with the key error of, `KeyError: 'height'` for certain assets. OpenAPI defines the height and width as required integer fields for the AssetResponseDto. However sometimes the return asset objects where these keys are completely missing not just null but absent from JSON. ### The OS that Immich Server is running on MacOS/Ubuntu ### Version of Immich Server v2.4.1 ### Version of Immich Mobile App N/A ### Platform with the issue - [x] Server - [ ] Web - [ ] Mobile ### Device make and model Macbook M4 & Home Server ### Your docker-compose.yml content ```YAML N/A ``` ### Your .env content ```Shell N/A ``` ### Reproduction steps 1. Generate Python API using latest OpenAPI spec 2. Perform a search_metadata call that returns a mix of assets (Specifically ones that might be missing something or just generally older) 3. The client raises a KeyError when parsing the response ... ### Relevant log output ```shell Inside immich_client/models/asset_response_dto.py inside from_dict method height = d.pop("height") width = d.pop("width") File "immich_client/api/search/search_metadata.py", line XX, in _parse_response return AssetResponseDto.from_dict(data) File "immich_client/models/asset_response_dto.py", line 226, in from_dict height = d.pop("height") KeyError: 'height' Expected: - Marking them as Optional/Null by default or 0 or None if missing Actual: - Client enforces the strict requirements from the spec and crashes upon receiving a response that omits these fields. ``` ### Additional information The manual fix I implemented ``` height = d.pop("height", None) width = d.pop("width", None) ``` Please reach out I can send more code snippets from my actual code that raised these errors. Maybe I was interacting with something incorrectly.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: immich-app/immich#8359