immich icon indicating copy to clipboard operation
immich copied to clipboard

[BUG] Error while getting remote assets: Null check operator used on a null value

Open illnesse opened this issue 1 year ago • 4 comments

The bug

I'd love to get Immich to work properly as it seems very promising, but i have a few issues with uploading. I've been trying to fix things on and off for months now (sadly didn't have a lot of time for debugging though)

Clients are Web, 2 Androids and one iOS device. all up to date. Server stack is in Docker, running in an LXC container

When refreshing the "Photos" tab in the app i keep getting following error in the log

from AssetService

#0      AssetResponseDto.fromJson (package:openapi/model/asset_response_dto.dart:310)
#1      ApiClient._deserialize (package:openapi/api_client.dart:239)
#2      ApiClient._deserialize.<anonymous closure> (package:openapi/api_client.dart:502)
#3      MappedListIterable.elementAt (dart:_internal/iterable.dart:415)
#4      ListIterator.moveNext (dart:_internal/iterable.dart:344)
#5      new _List._ofEfficientLengthIterable (dart:core-patch/array.dart:162)
#6      new _List.of (dart:core-patch/array.dart:127)
#7      new List.of (dart:core-patch/array_patch.dart:49)
#8      SetBase.toList (dart:collection/set.dart:119)
#9      ApiClient._deserialize (package:openapi/api_client.dart:503)
#10     ApiClient.deserialize (package:openapi/api_client.dart:158)
<asynchronous suspension>
#11     AssetApi.getAllAssets (package:openapi/api/asset_api.dart:409)
<asynchronous suspension>
#12     AssetService._getRemoteAssets (package:immich_mobile/shared/services/asset.service.dart:72)
<asynchronous suspension>
#13     SyncService._syncRemoteAssetsFull (package:immich_mobile/shared/services/sync.service.dart:209)
<asynchronous suspension>
#14     SyncService.syncRemoteAssetsToDb.<anonymous closure> (package:immich_mobile/shared/services/sync.service.dart:53)
<asynchronous suspension>

Probably separate issue but previously uploaded images still have the cloud-dash icon, indicating that it hasn't been uploaded yet:

immich1

i can see the file in /library/admin/2024/2024-01-03/ though

The OS that Immich Server is running on

Ubuntu 22.04

Version of Immich Server

v1.91.4

Version of Immich Mobile App

v1.91.4

Platform with the issue

  • [X] Server
  • [ ] Web
  • [X] Mobile

Your docker-compose.yml content

version: "3.8"

services:
  immich-server:
    container_name: immich_server
    image: ghcr.io/immich-app/immich-server:${IMMICH_VERSION:-release}
    command: ["start.sh", "immich"]
    volumes:
      - ${UPLOAD_LOCATION}:/usr/src/app/upload
      - /media/crypt1/:/media/crypt1/:ro
      - /etc/localtime:/etc/localtime:ro
    env_file:
      - stack.env
    ports:
      - 2283:3001
    depends_on:
      - redis
      - database
    restart: always

  immich-microservices:
    container_name: immich_microservices
    image: ghcr.io/immich-app/immich-server:${IMMICH_VERSION:-release}
     #extends:
       #file: hwaccel.yml
       #service: hwaccel
    command: ["start.sh", "microservices"]
    volumes:
      - ${UPLOAD_LOCATION}:/usr/src/app/upload
      - /media/crypt1/:/media/crypt1/:ro
      - /etc/localtime:/etc/localtime:ro
    env_file:
      - stack.env
    depends_on:
      - redis
      - database
    restart: always

  immich-machine-learning:
    container_name: immich_machine_learning
    image: ghcr.io/immich-app/immich-machine-learning:${IMMICH_VERSION:-release}
    volumes:
      - model-cache:/cache
    env_file:
      - stack.env
    restart: always

  redis:
    container_name: immich_redis
    image: redis:6.2-alpine@sha256:70a7a5b641117670beae0d80658430853896b5ef269ccf00d1827427e3263fa3
    restart: always

  database:
    container_name: immich_postgres
    image: tensorchord/pgvecto-rs:pg14-v0.1.11
    env_file:
      - stack.env
    environment:
      POSTGRES_PASSWORD: ${DB_PASSWORD}
      POSTGRES_USER: ${DB_USERNAME}
      POSTGRES_DB: ${DB_DATABASE_NAME}
    volumes:
      - pgdata:/var/lib/postgresql/data
    restart: always

volumes:
  pgdata:
  model-cache:

Your .env content

UPLOAD_LOCATION=/media/crypt1/Immich
IMMICH_VERSION=release
TYPESENSE_API_KEY=[redacted]
DB_PASSWORD=[redacted]
DB_HOSTNAME=immich_postgres
DB_USERNAME=postgres
DB_DATABASE_NAME=[redacted]
REDIS_HOSTNAME=immich_redis

Reproduction steps

1. open app
2. swipe down to refresh
3. check logs

Additional information

No response

illnesse avatar Jan 04 '24 15:01 illnesse

Same here but it's preventing login since a few days ago:

#0      UserResponseDto.fromJson (package:openapi/model/user_response_dto.dart:176)
#1      ApiClient.fromJson (package:openapi/api_client.dart:508)
#2      ApiClient.deserialize (package:openapi/api_client.dart:158)
<asynchronous suspension>
#3      UserApi.getMyUserInfo (package:openapi/api/user_api.dart:295)
<asynchronous suspension>
#4      AuthenticationNotifier.setSuccessLoginInfo (package:immich_mobile/modules/login/providers/authentication.provider.dart:185)
<asynchronous suspension>
#5      LoginForm.build.login (package:immich_mobile/modules/login/ui/login_form.dart:152)
<asynchronous suspension>

Screenshot_20240318_134401 Screenshot_20240318_134356

brennoflaviodaloopa avatar Mar 18 '24 16:03 brennoflaviodaloopa

@brennoflaviodaloopa can you make sure your server is on the latest version?

alextran1502 avatar Mar 18 '24 17:03 alextran1502

@brennoflaviodaloopa can you make sure your server is on the latest version?

Confirmed that works on latest version, my bad

brennoflavio avatar Mar 18 '24 17:03 brennoflavio

Hello @illnesse I'm trying to reproduce this issue with the server and mobile application version 1.102.3 and everything works fine. Is this error still relevant?

pretorean avatar Apr 21 '24 21:04 pretorean

This particular error from the open-api generated code usually comes when there is a mismatch between the server and the mobile app. We have since then added logic to provide backward compatibility to prevent such issues.

shenlong-tanwen avatar Apr 07 '25 19:04 shenlong-tanwen