operator class "gin_trgm_ops" does not exist for access method "gin" #2518

Closed
opened 2026-02-05 06:09:34 +03:00 by OVERLORD · 0 comments
Owner

Originally created by @blablack on GitHub (Mar 10, 2024).

The bug

Hello

After upgrading from 1.97.0 to to 1.98.1, I get this error when immich starts:

[Nest] 7  - 03/10/2024, 8:25:20 PM     LOG [CommunicationRepository] Initialized websocket server
Migration "AddAssetOriginalPathTrigramIndex1709608140355" failed, error: operator class "gin_trgm_ops" does not exist for access method "gin"
/usr/src/app/node_modules/typeorm/driver/postgres/PostgresQueryRunner.js:219
            throw new QueryFailedError_1.QueryFailedError(query, parameters, err);
                  ^

QueryFailedError: operator class "gin_trgm_ops" does not exist for access method "gin"
    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 AddAssetOriginalPathTrigramIndex1709608140355.up (/usr/src/app/dist/infra/migrations/1709608140355-AddAssetOriginalPathTrigramIndex.js:6:9)
    at async MigrationExecutor.executePendingMigrations (/usr/src/app/node_modules/typeorm/migration/MigrationExecutor.js:225:17)
    at async DataSource.runMigrations (/usr/src/app/node_modules/typeorm/data-source/DataSource.js:265:35)
    at async DatabaseRepository.runMigrations (/usr/src/app/dist/infra/repositories/database.repository.js:177:9)
    at async /usr/src/app/dist/domain/database/database.service.js:52:13
    at async /usr/src/app/dist/infra/repositories/database.repository.js:185:23 {
  query: '\n' +
    '    CREATE INDEX idx_originalFileName_trigram\n' +
    '        ON assets\n' +
    '    USING gin (f_unaccent("originalFileName") gin_trgm_ops)',
  parameters: undefined,
  driverError: error: operator class "gin_trgm_ops" does not exist for access method "gin"
      at /usr/src/app/node_modules/pg/lib/client.js:526:17
      at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
      at async PostgresQueryRunner.query (/usr/src/app/node_modules/typeorm/driver/postgres/PostgresQueryRunner.js:184:25)
      at async AddAssetOriginalPathTrigramIndex1709608140355.up (/usr/src/app/dist/infra/migrations/1709608140355-AddAssetOriginalPathTrigramIndex.js:6:9)
      at async MigrationExecutor.executePendingMigrations (/usr/src/app/node_modules/typeorm/migration/MigrationExecutor.js:225:17)
      at async DataSource.runMigrations (/usr/src/app/node_modules/typeorm/data-source/DataSource.js:265:35)
      at async DatabaseRepository.runMigrations (/usr/src/app/dist/infra/repositories/database.repository.js:177:9)
      at async /usr/src/app/dist/domain/database/database.service.js:52:13
      at async /usr/src/app/dist/infra/repositories/database.repository.js:185:23 {
    length: 131,
    severity: 'ERROR',
    code: '42704',
    detail: undefined,
    hint: undefined,
    position: undefined,
    internalPosition: undefined,
    internalQuery: undefined,
    where: undefined,
    schema: undefined,
    table: undefined,
    column: undefined,
    dataType: undefined,
    constraint: undefined,
    file: 'indexcmds.c',
    line: '2257',
    routine: 'ResolveOpClass'
  },
  length: 131,
  severity: 'ERROR',
  code: '42704',
  detail: undefined,
  hint: undefined,
  position: undefined,
  internalPosition: undefined,
  internalQuery: undefined,
  where: undefined,
  schema: undefined,
  table: undefined,
  column: undefined,
  dataType: undefined,
  constraint: undefined,
  file: 'indexcmds.c',
  line: '2257',
  routine: 'ResolveOpClass'
}

Node.js v20.11.1

Thanks in advance for the assistance,
Aurélien

The OS that Immich Server is running on

Docker

Version of Immich Server

v1.98.1

Version of Immich Mobile App

v1.98.1

Platform with the issue

  • Server
  • Web
  • Mobile

Your docker-compose.yml content

apiVersion: v1
kind: ConfigMap
metadata:
  name: immich-postgres
data:
  create-extensions.sql: |
    CREATE EXTENSION IF NOT EXISTS cube;
    CREATE EXTENSION IF NOT EXISTS earthdistance;
    CREATE EXTENSION IF NOT EXISTS vectors;
    CREATE EXTENSION IF NOT EXISTS pg_trgm;
    CREATE EXTENSION IF NOT EXISTS unaccent;
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: immich
spec:
  replicas: 1
  revisionHistoryLimit: 0
  selector:
    matchLabels:
      app: immich
  strategy:
    type: Recreate
  template:
    metadata:
      labels:
        app: immich
    spec:
      volumes:
        - name: immich-pvc
          persistentVolumeClaim:
            claimName: immich-pvc
        - name: nasio-nfs-pvc
          persistentVolumeClaim:
            claimName: nasio-nfs-pvc
        - configMap:
            name: immich-postgres
          name: immich-postgres-vol
      containers:
        - image: tensorchord/pgvecto-rs:pg16-v0.2.0
          imagePullPolicy: IfNotPresent
          name: postgres
          env:
            - name: POSTGRES_USER
              value: "immich"
            - name: POSTGRES_PASSWORD
              value: "immich"
            - name: POSTGRES_DB
              value: "immich"
          volumeMounts:
            - mountPath: "/var/lib/postgresql/data"
              subPath: "postgresql"
              name: immich-pvc
            - name: immich-postgres-vol
              subPath: "create-extensions.sql"
              mountPath: "/docker-entrypoint-initdb.d/create-extensions.sql"
          resources:
            limits:
              cpu: 200m
              memory: 300Mi
            requests:
              cpu: 10m
              memory: 50Mi
        - image: redis:latest
          imagePullPolicy: IfNotPresent
          name: redis
          resources:
            limits:
              cpu: 40m
              memory: 200Mi
            requests:
              cpu: 10m
              memory: 10Mi
        - image: ghcr.io/immich-app/immich-server:v1.98.1
          imagePullPolicy: IfNotPresent
          name: immich-server
          command: ["./start-server.sh"]
          env:
            - name: DB_USERNAME
              value: "immich"
            - name: DB_PASSWORD
              value: "immich"
            - name: DB_DATABASE_NAME
              value: "immich"
            - name: REDIS_HOSTNAME
              value: "localhost"
          ports:
            - containerPort: 3001
              name: http
          livenessProbe:
            httpGet:
              path: /server-info/ping
              port: http
            initialDelaySeconds: 90
            periodSeconds: 10
            timeoutSeconds: 10
            failureThreshold: 5
          readinessProbe:
            httpGet:
              path: /server-info/ping
              port: http
            initialDelaySeconds: 90
            periodSeconds: 10
            timeoutSeconds: 10
            failureThreshold: 5
          volumeMounts:
            - mountPath: "/photos"
              subPath: "Our Pictures"
              name: nasio-nfs-pvc
              readOnly: true
            - mountPath: "/usr/src/app/upload"
              subPath: "Kubernetes/Our Pictures - Immich"
              name: nasio-nfs-pvc
          resources:
            limits:
              cpu: 500m
              memory: 500Mi
            requests:
              cpu: 10m
              memory: 100Mi
        - image: ghcr.io/immich-app/immich-server:v1.98.1
          imagePullPolicy: IfNotPresent
          name: immich-microservices
          command: ["./start-microservices.sh"]
          env:
            - name: DB_USERNAME
              value: "immich"
            - name: DB_PASSWORD
              value: "immich"
            - name: DB_DATABASE_NAME
              value: "immich"
            - name: REDIS_HOSTNAME
              value: "localhost"
            - name: REVERSE_GEOCODING_DUMP_DIRECTORY
              value: "/geodata-cache"
            - name: IMMICH_MACHINE_LEARNING_URL
              value: "http://localhost:3003"
          volumeMounts:
            - mountPath: "/geodata-cache"
              subPath: "geodata-cache"
              name: immich-pvc
            - mountPath: "/photos"
              subPath: "Our Pictures"
              name: nasio-nfs-pvc
              readOnly: true
            - mountPath: "/usr/src/app/upload"
              subPath: "Kubernetes/Our Pictures - Immich"
              name: nasio-nfs-pvc
          resources:
            limits:
              cpu: 400m
              memory: 500Mi
            requests:
              cpu: 10m
              memory: 100Mi
        - image: ghcr.io/immich-app/immich-machine-learning:v1.98.1
          imagePullPolicy: IfNotPresent
          name: immich-machine-learning
          env:
            - name: TRANSFORMERS_CACHE
              value: "/cache"
          ports:
            - containerPort: 3003
              name: http
          livenessProbe:
            httpGet:
              path: /ping
              port: http
            initialDelaySeconds: 90
            periodSeconds: 10
            timeoutSeconds: 10
            failureThreshold: 5
          readinessProbe:
            httpGet:
              path: /ping
              port: http
            initialDelaySeconds: 90
            periodSeconds: 10
            timeoutSeconds: 10
            failureThreshold: 5
          volumeMounts:
            - mountPath: "/cache"
              subPath: "ml-cache"
              name: immich-pvc
          resources:
            limits:
              cpu: 600m
              memory: 1500Mi
            requests:
              cpu: 10m
              memory: 1000Mi
      dnsPolicy: "None"
      dnsConfig:
        nameservers:
          - 10.43.0.22

Your .env content

Available in k8s deployment

Reproduction steps

1. have 1.97.0 running
2. update deployment to get 1.98.1 docker image
3. restart deployment

Additional information

No response

Originally created by @blablack on GitHub (Mar 10, 2024). ### The bug Hello After upgrading from 1.97.0 to to 1.98.1, I get this error when immich starts: ``` [Nest] 7 - 03/10/2024, 8:25:20 PM  LOG [CommunicationRepository] Initialized websocket server Migration "AddAssetOriginalPathTrigramIndex1709608140355" failed, error: operator class "gin_trgm_ops" does not exist for access method "gin" /usr/src/app/node_modules/typeorm/driver/postgres/PostgresQueryRunner.js:219 throw new QueryFailedError_1.QueryFailedError(query, parameters, err); ^ QueryFailedError: operator class "gin_trgm_ops" does not exist for access method "gin" 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 AddAssetOriginalPathTrigramIndex1709608140355.up (/usr/src/app/dist/infra/migrations/1709608140355-AddAssetOriginalPathTrigramIndex.js:6:9) at async MigrationExecutor.executePendingMigrations (/usr/src/app/node_modules/typeorm/migration/MigrationExecutor.js:225:17) at async DataSource.runMigrations (/usr/src/app/node_modules/typeorm/data-source/DataSource.js:265:35) at async DatabaseRepository.runMigrations (/usr/src/app/dist/infra/repositories/database.repository.js:177:9) at async /usr/src/app/dist/domain/database/database.service.js:52:13 at async /usr/src/app/dist/infra/repositories/database.repository.js:185:23 { query: '\n' + ' CREATE INDEX idx_originalFileName_trigram\n' + ' ON assets\n' + ' USING gin (f_unaccent("originalFileName") gin_trgm_ops)', parameters: undefined, driverError: error: operator class "gin_trgm_ops" does not exist for access method "gin" at /usr/src/app/node_modules/pg/lib/client.js:526:17 at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async PostgresQueryRunner.query (/usr/src/app/node_modules/typeorm/driver/postgres/PostgresQueryRunner.js:184:25) at async AddAssetOriginalPathTrigramIndex1709608140355.up (/usr/src/app/dist/infra/migrations/1709608140355-AddAssetOriginalPathTrigramIndex.js:6:9) at async MigrationExecutor.executePendingMigrations (/usr/src/app/node_modules/typeorm/migration/MigrationExecutor.js:225:17) at async DataSource.runMigrations (/usr/src/app/node_modules/typeorm/data-source/DataSource.js:265:35) at async DatabaseRepository.runMigrations (/usr/src/app/dist/infra/repositories/database.repository.js:177:9) at async /usr/src/app/dist/domain/database/database.service.js:52:13 at async /usr/src/app/dist/infra/repositories/database.repository.js:185:23 { length: 131, severity: 'ERROR', code: '42704', detail: undefined, hint: undefined, position: undefined, internalPosition: undefined, internalQuery: undefined, where: undefined, schema: undefined, table: undefined, column: undefined, dataType: undefined, constraint: undefined, file: 'indexcmds.c', line: '2257', routine: 'ResolveOpClass' }, length: 131, severity: 'ERROR', code: '42704', detail: undefined, hint: undefined, position: undefined, internalPosition: undefined, internalQuery: undefined, where: undefined, schema: undefined, table: undefined, column: undefined, dataType: undefined, constraint: undefined, file: 'indexcmds.c', line: '2257', routine: 'ResolveOpClass' } Node.js v20.11.1 ``` Thanks in advance for the assistance, Aurélien ### The OS that Immich Server is running on Docker ### Version of Immich Server v1.98.1 ### Version of Immich Mobile App v1.98.1 ### Platform with the issue - [X] Server - [ ] Web - [ ] Mobile ### Your docker-compose.yml content ```YAML apiVersion: v1 kind: ConfigMap metadata: name: immich-postgres data: create-extensions.sql: | CREATE EXTENSION IF NOT EXISTS cube; CREATE EXTENSION IF NOT EXISTS earthdistance; CREATE EXTENSION IF NOT EXISTS vectors; CREATE EXTENSION IF NOT EXISTS pg_trgm; CREATE EXTENSION IF NOT EXISTS unaccent; --- apiVersion: apps/v1 kind: Deployment metadata: name: immich spec: replicas: 1 revisionHistoryLimit: 0 selector: matchLabels: app: immich strategy: type: Recreate template: metadata: labels: app: immich spec: volumes: - name: immich-pvc persistentVolumeClaim: claimName: immich-pvc - name: nasio-nfs-pvc persistentVolumeClaim: claimName: nasio-nfs-pvc - configMap: name: immich-postgres name: immich-postgres-vol containers: - image: tensorchord/pgvecto-rs:pg16-v0.2.0 imagePullPolicy: IfNotPresent name: postgres env: - name: POSTGRES_USER value: "immich" - name: POSTGRES_PASSWORD value: "immich" - name: POSTGRES_DB value: "immich" volumeMounts: - mountPath: "/var/lib/postgresql/data" subPath: "postgresql" name: immich-pvc - name: immich-postgres-vol subPath: "create-extensions.sql" mountPath: "/docker-entrypoint-initdb.d/create-extensions.sql" resources: limits: cpu: 200m memory: 300Mi requests: cpu: 10m memory: 50Mi - image: redis:latest imagePullPolicy: IfNotPresent name: redis resources: limits: cpu: 40m memory: 200Mi requests: cpu: 10m memory: 10Mi - image: ghcr.io/immich-app/immich-server:v1.98.1 imagePullPolicy: IfNotPresent name: immich-server command: ["./start-server.sh"] env: - name: DB_USERNAME value: "immich" - name: DB_PASSWORD value: "immich" - name: DB_DATABASE_NAME value: "immich" - name: REDIS_HOSTNAME value: "localhost" ports: - containerPort: 3001 name: http livenessProbe: httpGet: path: /server-info/ping port: http initialDelaySeconds: 90 periodSeconds: 10 timeoutSeconds: 10 failureThreshold: 5 readinessProbe: httpGet: path: /server-info/ping port: http initialDelaySeconds: 90 periodSeconds: 10 timeoutSeconds: 10 failureThreshold: 5 volumeMounts: - mountPath: "/photos" subPath: "Our Pictures" name: nasio-nfs-pvc readOnly: true - mountPath: "/usr/src/app/upload" subPath: "Kubernetes/Our Pictures - Immich" name: nasio-nfs-pvc resources: limits: cpu: 500m memory: 500Mi requests: cpu: 10m memory: 100Mi - image: ghcr.io/immich-app/immich-server:v1.98.1 imagePullPolicy: IfNotPresent name: immich-microservices command: ["./start-microservices.sh"] env: - name: DB_USERNAME value: "immich" - name: DB_PASSWORD value: "immich" - name: DB_DATABASE_NAME value: "immich" - name: REDIS_HOSTNAME value: "localhost" - name: REVERSE_GEOCODING_DUMP_DIRECTORY value: "/geodata-cache" - name: IMMICH_MACHINE_LEARNING_URL value: "http://localhost:3003" volumeMounts: - mountPath: "/geodata-cache" subPath: "geodata-cache" name: immich-pvc - mountPath: "/photos" subPath: "Our Pictures" name: nasio-nfs-pvc readOnly: true - mountPath: "/usr/src/app/upload" subPath: "Kubernetes/Our Pictures - Immich" name: nasio-nfs-pvc resources: limits: cpu: 400m memory: 500Mi requests: cpu: 10m memory: 100Mi - image: ghcr.io/immich-app/immich-machine-learning:v1.98.1 imagePullPolicy: IfNotPresent name: immich-machine-learning env: - name: TRANSFORMERS_CACHE value: "/cache" ports: - containerPort: 3003 name: http livenessProbe: httpGet: path: /ping port: http initialDelaySeconds: 90 periodSeconds: 10 timeoutSeconds: 10 failureThreshold: 5 readinessProbe: httpGet: path: /ping port: http initialDelaySeconds: 90 periodSeconds: 10 timeoutSeconds: 10 failureThreshold: 5 volumeMounts: - mountPath: "/cache" subPath: "ml-cache" name: immich-pvc resources: limits: cpu: 600m memory: 1500Mi requests: cpu: 10m memory: 1000Mi dnsPolicy: "None" dnsConfig: nameservers: - 10.43.0.22 ``` ### Your .env content ```Shell Available in k8s deployment ``` ### Reproduction steps ```bash 1. have 1.97.0 running 2. update deployment to get 1.98.1 docker image 3. restart deployment ``` ### Additional information _No response_
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: immich-app/immich#2518