Skip to content

[Bug]: PDF preview fails with SQLSTATE[23000]: Column 'file_id' in where clause is ambiguous (v34.0.3.2) #63462

Closed as duplicate

Description

@james41459

⚠️ This issue respects the following points: ⚠️

Bug description

⚠️ This issue respects the following points:

  • This is a bug, not a question or a configuration/webserver/proxy issue.
  • This issue is not already reported on Github (I've searched it).
  • Nextcloud Server is up to date.
  • I agree to follow Nextcloud's Code of Conduct.

Nextcloud Server version

34.0.3.2

Operating system

Ubuntu (via Nextcloud Snap package)

PHP engine version

Bundled with Nextcloud Snap

Web server

Bundled with Nextcloud Snap (Apache)

Database engine version

MySQL/MariaDB (bundled with Nextcloud Snap)

Is this bug present after an update or on a fresh install?

Updated to a major version (ex. 34.0.2 to 34.0.3)

Steps to reproduce

  1. Update Nextcloud from 34.0.2.1 to 34.0.3.2
  2. Open the Files app
  3. Click on any PDF file to preview it in the built-in viewer

Expected behaviour

The PDF preview should load and display normally.

Actual behaviour

The preview fails to load. The following exception is logged repeatedly in nextcloud.log for every PDF file opened:

An exception occurred while executing a query: SQLSTATE[23000]: Integrity constraint violation: 1052 Column 'file_id' in where clause is ambiguous

This occurs in OC\Preview\Db\PreviewMapper->getPreviewForSpecification(), called from OC\Preview\Generator->savePreview() / generatePreview() / generatePreviews(), triggered by core/Controller/PreviewController.php.

The error only affects PDF files. Images preview normally. Disabling the files_pdfviewer app works around the issue (files fall back to download instead of preview), but this is only a workaround, not a fix.

List of activated Apps

files_pdfviewer: 7.0.0-dev.0
(plus default Nextcloud Snap app set)

Nextcloud Signaling Server

No response

Are you using encryption?

No

Are you using an external user-backend?

No

Full log excerpt

{"reqId":"k1pOHQf7UFdlzhypnuyn","level":3,"time":"2026-08-20T23:18:16+00:00","app":"index","method":"GET","url":"/index.php/core/preview?fileId=57&x=256&y=256&a=1&mode=cover&forceIcon=0","message":"An exception occurred while executing a query: SQLSTATE[23000]: Integrity constraint violation: 1052 Column 'file_id' in where clause is ambiguous","exception":{"Exception":"OC\DB\Exceptions\DbalException","Trace":[
{"file":"lib/private/Preview/Db/PreviewMapper.php","line":250,"function":"findEntity"},
{"file":"lib/private/Preview/Generator.php","line":605,"function":"getPreviewForSpecification"},
{"file":"lib/private/Preview/Generator.php","line":566,"function":"savePreview"},
{"file":"lib/private/Preview/Generator.php","line":184,"function":"generatePreview"},
{"file":"lib/private/Preview/Generator.php","line":95,"function":"generatePreviews"},
{"file":"lib/private/PreviewManager.php","line":183,"function":"getPreview"},
{"file":"core/Controller/PreviewController.php","line":166,"function":"getPreview"}
]}}

Additional info

  • A similar report from another user (German Nextcloud community forum, help.nextcloud.com) shows the exact same SQLSTATE[23000] / file_id ambiguous error appearing in the preview:pre-generate cron job after updating to the latest version, dated August 2026 — suggesting this may affect multiple installations after the 34.0.3.x update.
  • Ran occ maintenance:repair — completed without errors, did not resolve the issue.
  • Confirmed the bug is specific to PDF preview generation; other file types (images) preview correctly.

Steps to reproduce

Expected behavior

Read pdf

Nextcloud Server version

32

Operating system

No response

PHP engine version

No response

Web server

No response

Database engine version

No response

Is this bug present after an update or on a fresh install?

No response

Are you using the Nextcloud Server Encryption module?

No response

What user-backends are you using?

  • Default user-backend (database)
  • LDAP/ Active Directory
  • SSO - SAML
  • Other

Configuration report

List of activated Apps

Nextcloud Signing status

Nextcloud Logs

Additional info

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    0. Needs triagePending check for reproducibility or if it fits our roadmap34-feedbackbug

    Type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions