immich-app / immich

High performance self-hosted photo and video management solution.
https://immich.app
GNU Affero General Public License v3.0
44.98k stars 2.18k forks source link

Cannot upload files using immich-cli #8028

Closed reypm closed 5 months ago

reypm commented 6 months ago

The bug

I tried to upload an entire folder using immich-cli as follows:

immich upload --recursive photos_backup/ --album-name photos

but it did not work correctly and failed with the following error:

Crawling for assets...
Checking assets | ████████████████████████████████████████ | 100% | ETA: 0s | 2729/2729 assets
Uploading assets | ████████████████████████████████████████ | 100% | ETA: 0s | 0/0 B
All assets were already uploaded, nothing to do.
Creating albums | ████████████████████████████████████████ | 100% | ETA: 0s | 0/0 albums
Adding assets to albums | ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ | 0% | ETA: 0s | 0/2729 assets
file:///Users/reypm/.nvm/versions/node/v20.10.0/lib/node_modules/@immich/cli/dist/index.js:9798
  throw new y(e.status, e.data, e.headers);
        ^

y [Error]: Error: 500
    at Object.l [as ok] (file:///Users/reypm/.nvm/versions/node/v20.10.0/lib/node_modules/@immich/cli/dist/index.js:9798:9)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async UploadCommand.updateAlbums (file:///Users/reypm/.nvm/versions/node/v20.10.0/lib/node_modules/@immich/cli/dist/index.js:18394:11)
    at async UploadCommand.run (file:///Users/reypm/.nvm/versions/node/v20.10.0/lib/node_modules/@immich/cli/dist/index.js:18230:56)
    at async Command.<anonymous> (file:///Users/reypm/.nvm/versions/node/v20.10.0/lib/node_modules/@immich/cli/dist/index.js:18501:3) {
  status: 500,
  data: {
    message: 'Failed to add assets to album',
    error: 'Internal Server Error',
    statusCode: 500
  },
  headers: Headers {
    [Symbol(headers list)]: HeadersList {
      cookies: null,
      [Symbol(headers map)]: Map(7) {
        'x-powered-by' => { name: 'X-Powered-By', value: 'Express' },
        'content-type' => {
          name: 'Content-Type',
          value: 'application/json; charset=utf-8'
        },
        'content-length' => { name: 'Content-Length', value: '92' },
        'etag' => { name: 'ETag', value: '"5c-lyaVQAHBg1LfX0s5U5+HqLAWa+A"' },
        'date' => { name: 'Date', value: 'Sun, 17 Mar 2024 19:23:54 GMT' },
        'connection' => { name: 'Connection', value: 'keep-alive' },
        'keep-alive' => { name: 'Keep-Alive', value: 'timeout=5' }
      },
      [Symbol(headers map sorted)]: null
    },
    [Symbol(guard)]: 'immutable',
    [Symbol(realm)]: null
  }
}

Node.js v20.10.0

and here are the docker logs related to the same issue:

[Nest] 8  - 03/17/2024, 3:13:05 PM   ERROR [Error: write EPIPE
    at WriteWrap.onWriteComplete [as oncomplete] (node:internal/stream_base_commons:94:16)] Failed to serve file
[Nest] 8  - 03/17/2024, 3:13:05 PM   ERROR [Error: write EPIPE
    at WriteWrap.onWriteComplete [as oncomplete] (node:internal/stream_base_commons:94:16)] Error: write EPIPE
[Nest] 8  - 03/17/2024, 3:13:09 PM    WARN [ExpressAdapter] Content-Type doesn't match Reply body, you might need a custom ExceptionFilter for non-JSON responses
[Nest] 8  - 03/17/2024, 3:13:13 PM    WARN [ExpressAdapter] Content-Type doesn't match Reply body, you might need a custom ExceptionFilter for non-JSON responses
[Nest] 8  - 03/17/2024, 3:13:31 PM    WARN [ExpressAdapter] Content-Type doesn't match Reply body, you might need a custom ExceptionFilter for non-JSON responses
[Nest] 8  - 03/17/2024, 3:13:50 PM    WARN [ExpressAdapter] Content-Type doesn't match Reply body, you might need a custom ExceptionFilter for non-JSON responses
[Nest] 8  - 03/17/2024, 3:15:24 PM    WARN [ExpressAdapter] Content-Type doesn't match Reply body, you might need a custom ExceptionFilter for non-JSON responses
[Nest] 8  - 03/17/2024, 3:15:25 PM    WARN [ExpressAdapter] Content-Type doesn't match Reply body, you might need a custom ExceptionFilter for non-JSON responses
[Nest] 8  - 03/17/2024, 3:15:48 PM    WARN [ExpressAdapter] Content-Type doesn't match Reply body, you might need a custom ExceptionFilter for non-JSON responses
[Nest] 8  - 03/17/2024, 3:15:55 PM    WARN [ExpressAdapter] Content-Type doesn't match Reply body, you might need a custom ExceptionFilter for non-JSON responses
[Nest] 8  - 03/17/2024, 3:17:36 PM    WARN [ExpressAdapter] Content-Type doesn't match Reply body, you might need a custom ExceptionFilter for non-JSON responses
[Nest] 8  - 03/17/2024, 3:17:50 PM   ERROR [Error: write EPIPE
    at WriteWrap.onWriteComplete [as oncomplete] (node:internal/stream_base_commons:94:16)] Failed to serve file
[Nest] 8  - 03/17/2024, 3:17:50 PM   ERROR [Error: write EPIPE
    at WriteWrap.onWriteComplete [as oncomplete] (node:internal/stream_base_commons:94:16)] Error: write EPIPE
[Nest] 8  - 03/17/2024, 3:18:57 PM     LOG [CommunicationRepository] Websocket Disconnect: Wlu40T9_9pxXi0c_AAAF
[Nest] 8  - 03/17/2024, 3:21:36 PM     LOG [ServerInfoService] Found 1.98.2, released at 3/11/2024, 10:31:35 AM
[Nest] 8  - 03/17/2024, 3:23:54 PM   ERROR [QueryFailedError: duplicate key value violates unique constraint "PK_c67bc36fa845fb7b18e0e398180"
    at PostgresQueryRunner.query (/usr/src/app/node_modules/typeorm/driver/postgres/PostgresQueryRunner.js:219:19)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async InsertQueryBuilder.execute (/usr/src/app/node_modules/typeorm/query-builder/InsertQueryBuilder.js:106:33)
    at async AlbumRepository.addAssets (/usr/src/app/dist/infra/repositories/album.repository.js:204:9)
    at async AlbumService.addAssets (/usr/src/app/dist/domain/album/album.service.js:164:13)] Failed to add assets to album

After it failed I checked the photos album and it was empty so no assets were uploaded.

The OS that Immich Server is running on

TrueNAS Scale Bluefin

Version of Immich Server

1.98.1

Version of Immich Mobile App

1.9.8.2

Platform with the issue

Your docker-compose.yml content

n/a

Your .env content

n/a

Reproduction steps

1. Just tried to upload a bunch of files and it failed

Additional information

No response

bo0tzz commented 6 months ago

Is your CLI on the latest version?

reypm commented 6 months ago

@bo0tzz I believe so ...

immich --version
2.1.0
alextran1502 commented 6 months ago

Besides the error messages, it said "All assets were already uploaded, nothing to do." is this correct?

reypm commented 6 months ago

@alextran1502 yes, correct, all you see in there is all I got on my end and no assets were uploaded

alextran1502 commented 6 months ago

Thank you, as a workaround, I suggest you try immich-go

Jetro97 commented 5 months ago

Same error here, photos get uploaded but never added to albums.