{"record":{"id":"4ea19ec6073bc1f9","repo":"immich-app/immich","slug":"table-table-does-not-exist-skipping-reindexing-this-is-only","errorCode":null,"errorMessage":"Table ${table} does not exist, skipping reindexing. This is only normal if this is a new Immich instance.","messagePattern":"Table (.+?) does not exist, skipping reindexing\\. This is only normal if this is a new Immich instance\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"server/src/repositories/database.repository.ts","lineNumber":222,"sourceCode":"        }\n      }\n    }\n\n    if (promises.length > 0) {\n      await Promise.all(promises);\n    }\n  }\n\n  private async reindexVectors(indexName: VectorIndex, { lists }: { lists?: number } = {}): Promise<void> {\n    this.logger.log(`Reindexing ${indexName} (This may take a while, do not restart)`);\n    const table = VECTOR_INDEX_TABLES[indexName];\n    const vectorExtension = await getVectorExtension(this.db);\n\n    const { rows } = await sql<{\n      columnName: string;\n    }>`SELECT column_name as \"columnName\" FROM information_schema.columns WHERE table_name = ${table}`.execute(this.db);\n    if (rows.length === 0) {\n      this.logger.warn(\n        `Table ${table} does not exist, skipping reindexing. This is only normal if this is a new Immich instance.`,\n      );\n      return;\n    }\n    const dimSize = await this.getDimensionSize(table);\n    lists ||= this.targetListCount(await this.getRowCount(table));\n    await this.db.transaction().execute(async (tx) => {\n      await sql`DROP INDEX IF EXISTS ${sql.raw(indexName)}`.execute(tx);\n      if (table === 'smart_search') {\n        await sql`ALTER TABLE ${sql.raw(table)} DROP CONSTRAINT IF EXISTS dim_size_constraint`.execute(tx);\n      }\n      if (rows.every((row) => row.columnName !== 'embedding')) {\n        this.logger.warn(`Column 'embedding' does not exist in table '${table}', truncating and adding column.`);\n        await sql`TRUNCATE TABLE ${sql.raw(table)}`.execute(tx);\n        await sql`ALTER TABLE ${sql.raw(table)} ADD COLUMN embedding real[] NOT NULL`.execute(tx);\n      }\n      await sql`ALTER TABLE ${sql.raw(table)} ALTER COLUMN embedding SET DATA TYPE real[]`.execute(tx);\n      await sql`","sourceCodeStart":204,"sourceCodeEnd":240,"githubUrl":"https://github.com/immich-app/immich/blob/e55ac299a4ec7cb372e35dbf2c6c05ee9ce77f6c/server/src/repositories/database.repository.ts#L204-L240","documentation":"During vector-index reindexing (e.g. after switching pgvector/VectoRA extensions), the code queries information_schema for the target table and aborts if the table has no columns/does not exist yet. This is expected on a brand-new Immich instance where migration has not yet created the embeddings tables, so it logs a warning and skips reindexing instead of failing.","triggerScenarios":"reindexVectors is invoked (via updateVectorExtension or reindexVectorsIfNeeded) while the smart_search or face_search table does not exist in the database — typically before the initial migration ran.","commonSituations":"Fresh Immich container starting up before migrations create tables; pointing Immich at an empty database; changing the vector extension in an environment where schema init hasn't run.","solutions":["Start Immich normally and let migrations run — the next reindex attempt after migration will succeed","Verify the database user can see the tables (correct database and schema in DB_URL)","Manually run migrations (server restart triggers runMigrations) before changing the vector extension","Ignore the warning if this is genuinely a new instance"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"const { rows } = await db.schema.from('information_schema.columns').select('column_name')\n  .where('table_name', '=', 'smart_search').execute();\nconst tableReady = rows.length > 0;\nif (!tableReady) throw new Error('smart_search table missing — run migrations before reindexing');","typeGuard":null,"tryCatchPattern":"try {\n  await db.reindexVectorsIfNeeded();\n} catch (err) {\n  if (isNewInstanceError(err)) logger.info('Skipping reindex on fresh instance');\n  else throw err;\n}","preventionTips":["Always let migrations run to completion before changing the vector extension","Point Immich at the correct database/schema in DB_URL","Run migrations before any manual schema operations","Don't run extension migrations against an empty/uninitialized database"],"tags":["database","postgres","migration","vector-index"],"backgroundTag":"empty-result-set","analyzedSha":"e55ac299a4ec7cb372e35dbf2c6c05ee9ce77f6c","analyzedAt":"2026-09-15T07:20:19.675Z","contentChangedAt":"2026-09-15T07:20:19.675Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}