Skip to content

Bug: Issue with database on self-hosted instance #3622

Description

@martinfojtik

Describe the bug

It started in: release.2026-07-26T01-04-56Z.2377, and it is the same in the latest release.

I have the following error in the logs constantly repeating:

{"level":40,"time":1785579324298,"pid":145,"hostname":"_obfuscated_","name":"teable","context":"V2SchemaOperationRunnerService","msg":"V2 schema operation runner failed to claim/run: Failed to claim schema operation: error: relation \"schema_operation\" does not exist"}
{"level":40,"time":1785579329306,"pid":145,"hostname":"_obfuscated_","name":"teable","context":"V2SchemaOperationRunnerService","msg":"V2 schema operation runner failed to claim/run: Failed to claim schema operation: error: relation \"schema_operation\" does not exist"}
{"level":40,"time":1785579334309,"pid":145,"hostname":"_obfuscated_","name":"teable","context":"V2SchemaOperationRunnerService","msg":"V2 schema operation runner failed to claim/run: Failed to claim schema operation: error: relation \"schema_operation\" does not exist"}
{"level":40,"time":1785579339326,"pid":145,"hostname":"_obfuscated_","name":"teable","context":"V2SchemaOperationRunnerService","msg":"V2 schema operation runner failed to claim/run: Failed to claim schema operation: error: relation \"schema_operation\" does not exist"}

When I try to open from the frontend, I get these in the backend log:

{"level":30,"time":1785579482777,"pid":145,"hostname":"_obfuscated_","name":"teable","req":{"id":"_obfuscated_","method":"GET","url":"/api/auth/user/me","query":{},"params":{"0":"api/auth/user/me"},"remoteAddress":"::ffff:127.0.0.1","remotePort":47348},"trace_id":"_obfuscated_","span_id":"1a73f6e6e1385995","trace_flags":"01","res":{"statusCode":200},"responseTime":12,"route":"/api/auth/user/me","is_access_token":false,"user_id":"_obfuscated_","session_id":"bsh-8xlVlEgZUxiUw-Ji1BcqEOcNvzbY","spanId":"1a73f6e6e1385995","traceId":"_obfuscated_","msg":"request completed"}
{"level":30,"time":1785579482812,"pid":145,"hostname":"_obfuscated_","name":"teable","req":{"id":"_obfuscated_","method":"GET","url":"/api/space/spcUK4o35u7qAt1BTzi","query":{},"params":{"0":"api/space/spcUK4o35u7qAt1BTzi"},"remoteAddress":"::ffff:127.0.0.1","remotePort":47348},"trace_id":"_obfuscated_","span_id":"f505fb2d8bae9247","trace_flags":"01","context":"PerformanceCacheService","is_access_token":false,"user_id":"_obfuscated_","spanId":"f505fb2d8bae9247","traceId":"_obfuscated_","msg":"Generated cache key: collaborator:_obfuscated_"}
{"level":50,"time":1785579482818,"pid":145,"hostname":"_obfuscated_","name":"teable","req":{"id":"_obfuscated_","method":"GET","url":"/api/user/last-visit/list-base","query":{},"params":{"0":"api/user/last-visit/list-base"},"remoteAddress":"::ffff:127.0.0.1","remotePort":47350},"trace_id":"_obfuscated_","span_id":"524d354b28e163ed","trace_flags":"01","context":"GlobalExceptionFilter","url":"/api/user/last-visit/list-base","message":"\nInvalid `prisma.$queryRawUnsafe()` invocation:\n\n\nRaw query failed. Code: `42P01`. Message: `relation \"user_last_visit\" does not exist`","is_access_token":false,"user_id":"_obfuscated_","spanId":"524d354b28e163ed","traceId":"_obfuscated_","msg":"PrismaClientKnownRequestError: \nInvalid `prisma.$queryRawUnsafe()` invocation:\n\n\nRaw query failed. Code: `42P01`. Message: `relation \"user_last_visit\" does not exist`\n    at Vn.handleRequestError (/app/node_modules/.pnpm/@prisma+client@6.2.1_prisma@6.2.1/node_modules/@prisma/client/runtime/library.js:121:7339)\n    at Vn.handleAndLogRequestError (/app/node_modules/.pnpm/@prisma+client@6.2.1_prisma@6.2.1/node_modules/@prisma/client/runtime/library.js:121:6663)\n    at Vn.request (/app/node_modules/.pnpm/@prisma+client@6.2.1_prisma@6.2.1/node_modules/@prisma/client/runtime/library.js:121:6370)\n    at async l (/app/node_modules/.pnpm/@prisma+client@6.2.1_prisma@6.2.1/node_modules/@prisma/client/runtime/library.js:130:9617)\n    at async LastVisitService.baseVisit (/app/enterprise/backend-ee/dist/index.js:423045:25)\n    at async LastVisitController.getUserLastVisitListBase (/app/enterprise/backend-ee/dist/index.js:792268:21)\n    at async /app/enterprise/backend-ee/dist/index.js:12793:24"}
{"level":30,"time":1785579482833,"pid":145,"hostname":"_obfuscated_","name":"teable","req":{"id":"_obfuscated_","method":"GET","url":"/api/user/last-visit/list-base","query":{},"params":{"0":"api/user/last-visit/list-base"},"remoteAddress":"::ffff:127.0.0.1","remotePort":47350},"trace_id":"_obfuscated_","span_id":"524d354b28e163ed","trace_flags":"01","res":{"statusCode":500},"err":{"type":"Error","message":"failed with status code 500","stack":"Error: failed with status code 500\n    at onResFinished (/app/node_modules/.pnpm/pino-http@10.5.0/node_modules/pino-http/logger.js:115:39)\n    at ServerResponse.onResponseComplete (/app/node_modules/.pnpm/pino-http@10.5.0/node_modules/pino-http/logger.js:178:14)\n    at /app/node_modules/.pnpm/@opentelemetry+context-async-hooks@2.0.1_@opentelemetry+api@1.9.0/node_modules/@opentelemetry/context-async-hooks/build/src/AbstractAsyncHooksContextManager.js:46:55\n    at AsyncLocalStorage.run (node:internal/async_local_storage/async_hooks:80:14)\n    at AsyncLocalStorageContextManager.with (/app/node_modules/.pnpm/@opentelemetry+context-async-hooks@2.0.1_@opentelemetry+api@1.9.0/node_modules/@opentelemetry/context-async-hooks/build/src/AsyncLocalStorageContextManager.js:33:40)\n    at ServerResponse.contextWrapper (/app/node_modules/.pnpm/@opentelemetry+context-async-hooks@2.0.1_@opentelemetry+api@1.9.0/node_modules/@opentelemetry/context-async-hooks/build/src/AbstractAsyncHooksContextManager.js:46:32)\n    at ServerResponse.emit (node:events:531:35)\n    at onFinish (node:_http_outgoing:1084:10)\n    at callback (node:internal/streams/writable:766:21)\n    at afterWrite (node:internal/streams/writable:710:5)\n    at afterWriteTick (node:internal/streams/writable:696:10)\n    at process.processTicksAndRejections (node:internal/process/task_queues:88:21)"},"responseTime":41,"route":"/api/user/last-visit/list-base","is_access_token":false,"user_id":"_obfuscated_","session_id":"bsh-8xlVlEgZUxiUw-Ji1BcqEOcNvzbY","spanId":"524d354b28e163ed","traceId":"_obfuscated_","msg":"request errored"}
Error: Internal Server Error
    at <unknown> (enterprise/app-ee/.next/server/chunks/ssr/[root-of-the-server]__1757d0f7._.js:1:5974) {
  status: 500,
  code: 'internal_server_error',
  data: undefined
}
⨯ Error: Internal Server Error
    at <unknown> (enterprise/app-ee/.next/server/chunks/ssr/[root-of-the-server]__1757d0f7._.js:1:5974) {
  status: 500,
  code: 'internal_server_error',
  data: undefined
}
⨯ Error: Internal Server Error
    at <unknown> (enterprise/app-ee/.next/server/chunks/ssr/[root-of-the-server]__1757d0f7._.js:1:5974) {
  status: 500,
  code: 'internal_server_error',
  data: undefined
}
{"level":30,"time":1785579482895,"pid":145,"hostname":"_obfuscated_","name":"teable","req":{"id":"_obfuscated_","method":"GET","url":"/space/spcUK4o35u7qAt1BTzi","query":{},"params":{"0":"space/spcUK4o35u7qAt1BTzi"},"remoteAddress":"::ffff:172.18.0.2","remotePort":52170},"trace_id":"_obfuscated_","span_id":"8e643aefebe36280","trace_flags":"01","res":{"statusCode":500},"err":{"type":"Error","message":"failed with status code 500","stack":"Error: failed with status code 500\n    at onResFinished (/app/node_modules/.pnpm/pino-http@10.5.0/node_modules/pino-http/logger.js:115:39)\n    at ServerResponse.onResponseComplete (/app/node_modules/.pnpm/pino-http@10.5.0/node_modules/pino-http/logger.js:178:14)\n    at /app/node_modules/.pnpm/@opentelemetry+context-async-hooks@2.0.1_@opentelemetry+api@1.9.0/node_modules/@opentelemetry/context-async-hooks/build/src/AbstractAsyncHooksContextManager.js:46:55\n    at AsyncLocalStorage.run (node:internal/async_local_storage/async_hooks:91:14)\n    at AsyncLocalStorageContextManager.with (/app/node_modules/.pnpm/@opentelemetry+context-async-hooks@2.0.1_@opentelemetry+api@1.9.0/node_modules/@opentelemetry/context-async-hooks/build/src/AsyncLocalStorageContextManager.js:33:40)\n    at ServerResponse.contextWrapper (/app/node_modules/.pnpm/@opentelemetry+context-async-hooks@2.0.1_@opentelemetry+api@1.9.0/node_modules/@opentelemetry/context-async-hooks/build/src/AbstractAsyncHooksContextManager.js:46:32)\n    at ServerResponse.emit (node:events:531:35)\n    at onFinish (node:_http_outgoing:1084:10)\n    at afterWrite (node:internal/streams/writable:710:5)\n    at afterWriteTick (node:internal/streams/writable:696:10)\n    at process.processTicksAndRejections (node:internal/process/task_queues:88:21)"},"responseTime":151,"route":"/space/?*","is_access_token":false,"spanId":"8e643aefebe36280","traceId":"_obfuscated_","msg":"request errored"}
{"level":30,"time":1785579482909,"pid":145,"hostname":"_obfuscated_","name":"teable","req":{"id":"_obfuscated_","method":"GET","url":"/api/space/spcUK4o35u7qAt1BTzi","query":{},"params":{"0":"api/space/spcUK4o35u7qAt1BTzi"},"remoteAddress":"::ffff:127.0.0.1","remotePort":47348},"trace_id":"_obfuscated_","span_id":"5f6607468787c393","trace_flags":"01","res":{"statusCode":200},"responseTime":123,"route":"/api/space/:spaceId","is_access_token":false,"user_id":"_obfuscated_","session_id":"bsh-8xlVlEgZUxiUw-Ji1BcqEOcNvzbY","spanId":"5f6607468787c393","traceId":"_obfuscated_","msg":"request completed"}

Logs from Postgres container show this:

2026-08-01 12:31:45.034 CEST [7529] ERROR:  relation "schema_operation" does not exist at character 67
 2026-08-01 12:31:45.034 CEST [7529] STATEMENT:  
 	        WITH candidate AS (
 	          SELECT "id"
 	          FROM "schema_operation"
 	          WHERE (
 	            ("status" = 'error' AND "next_run_at" <= $1)
 	            OR (
 	              "status" = 'pending'
 	              AND "next_run_at" <= $2
 	              AND "last_modified_time" <= $3
 	            )
 	            OR (
 	              "status" = 'running'
 	              AND "locked_at" IS NOT NULL
 	              AND "locked_at" <= $4
 	            )
 	          )
 	          AND "type" IN ($5, $6, $7, $8, $9)
 	          ORDER BY "next_run_at" ASC, "created_time" ASC
 	          LIMIT 1
 	          FOR UPDATE SKIP LOCKED
 	        )
 	        UPDATE "schema_operation"
 	        SET
 	          "status" = 'running',
 	          "phase" = $10,
 	          "locked_at" = $11,
 	          "locked_by" = $12,
 	          "last_modified_time" = $13,
 	          "last_modified_by" = $14
 	        FROM candidate
 	        WHERE "schema_operation"."id" = candidate."id"
 	        RETURNING "schema_operation".*
 	      

The front-end shows a 500 error, and I cannot log in. It starts working if I downgrade to 2026-07-23T12-32-52Z.2361.

I obfuscated some IDs from the logs.

To Reproduce
Steps to reproduce the behavior:

  1. Go to the Teable app; any URL shows that error

Expected behavior

The app should start properly.

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Platform (Please tell us which deployment version you are using)
docker-standalone

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions