Richdocuments WOPI internal server error

The Basics

  • Nextcloud Server version (e.g., 29.x.x):
    • 31.0.6.2
  • Operating system and version (e.g., Ubuntu 24.04):
    • docker (nextcloud:apache)
  • Web server and version (e.g, Apache 2.4.25):
    • Apache
  • Reverse proxy and version _(e.g. nginx 1.27.2)
    • nginx (jwilder/nginx-proxy)
  • PHP version (e.g, 8.3):
    • 8.3.22
  • Is this the first time you’ve seen this error? (Yes / No):
    • Yes
  • When did this problem seem to first start?
    • When I replaced CODE built-in with separate CODE container in order to better deal with me running things on a non-standard port. (Switched all back to 443 for debugging, sigh.)
  • Installation method (e.g. AlO, NCP, Bare Metal/Archive, etc.)
    • AIO
  • Are you using CloudfIare, mod_security, or similar? (Yes / No)
    • No
  • CODE:
    • 25.04.3.1
  • Richdocuments (aka. Nextcloud Office)
    • 8.7.1

Summary of the issue you are facing:

Getting “Unauthenticated WOPI host” all the time, even if I let the wopi_allowlist empty.
In reality, it was not a 403, but a 500.

wsd-00001-00032 2025-06-26 21:38:44.587653 +0000 [ websrv_poll ] ERR  #31: WOPI::CheckFileInfo failed for URI [https://REDACTED/index.php/apps/richdocuments/wopi/files/34479864_ocf0b57c7cb0?access_token=REDACTED&access_token_ttl=0]: 500 (Internal Server Error) Internal Server Error. Headers: Server: nginx/1.27.5 / Date: Thu, 26 Jun 2025 21:38:44 GMT / Content-Type: application/json; charset=utf-8 / Content-Length: 19 / Connection: keep-alive / X-Content-Type-Options: nosniff / X-Frame-Options: SAMEORIGIN / X-Permitted-Cross-Domain-Policies: none / X-Robots-Tag: noindex, nofollow / X-XSS-Protection: 1; mode=block / Referrer-Policy: no-referrer / X-Powered-By: PHP/8.3.22 / Set-Cookie: ocf0b57c7cb0=ec68e3....; path=/; secure; HttpOnly; SameSite=Lax / Content-Security-Policy: default-src 'none';base-uri 'none';manifest-src 'self';frame-ancestors 'none' / X-Request-Id: Ck7cMDpkMSMSpErnh6w0 / Cache-Control: no-cache, no-store, must-revalidate / Feature-Policy: autoplay 'none';camera 'none';fullscreen 'none';geolocation 'none';microphone 'none';payment 'none' / Strict-Transport-Security: max-age=31536000      Body: [{"message":"Error"}]| wsd/wopi/CheckFileInfo.cpp:107                                                                                                                       

In the logs, I eventually found this:

{"reqId":"Van3LHvlQRHO0g9BjTgN","level":3,"time":"2025-06-26T21:52:57+00:00","remoteAddr":"192.168.155.10","user":"--","app":"richdocuments","method":"GET","url":"/index.php/apps/richdocuments/wopi/files/34479864_ocf0b57c7cb0?access_token=REDACTED&access_token_ttl=0&no_auth_header=&permission=edit","message":"Uncaught error: An exception occurred while executing a query: SQLSTATE[22003]: Numeric value out of range: 1264 Out of range value for column 'fileid' at row 1","userAgent":"COOLWSD HTTP Agent 25.04.3.1","version":"31.0.6.2","exception":{"Exception":"OC\\DB\\Exceptions\\DbalException","Message":"An exception occurred while executing a query: SQLSTATE[22003]: Numeric value out of range: 1264 Out of range value for column 'fileid' at row 1","Code":1264,"Trace":[{"file":"/var/www/html/lib/private/DB/ConnectionAdapter.php","line":69,"function":"wrap","class":"OC\\DB\\Exceptions\\DbalException","type":"::","args":[{"__class__":"Doctrine\\DBAL\\Exception\\DriverException"},"","INSERT INTO `*PREFIX*richdocuments_wopi` (`fileid`, `owner_uid`, `editor_uid`, `version`, `canwrite`, `server_host`, `token`, `expiry`, `template_id`, `token_type`) VALUES(:dcValue1, :dcValue2, :dcValue3, :dcValue4, :dcValue5, :dcValue6, :dcValue7, :dcValue8, :dcValue9, :dcValue10)"]},{"file":"/var/www/html/lib/private/DB/QueryBuilder/QueryBuilder.php","line":306,"function":"executeStatement","class":"OC\\DB\\ConnectionAdapter","type":"->","args":["INSERT INTO `*PREFIX*richdocuments_wopi` (`fileid`, `owner_uid`, `editor_uid`, `version`, `canwrite`, `server_host`, `token`, `expiry`, `template_id`, `token_type`) VALUES(:dcValue1, :dcValue2, :dcValue3, :dcValue4, :dcValue5, :dcValue6, :dcValue7, :dcValue8, :dcValue9, :dcValue10)",{"dcValue1":-1,"dcValue2":"admin","dcValue3":"admin","dcValue4":25,"dcValue5":true,"dcValue6":"https://REDACTED","dcValue7":"4Idm1Ke2qLMRT3AIvuawxsUxDqmX2lY1","dcValue8":1751010777,"dcValue9":0,"dcValue10":5},{"dcValue1":1,"dcValue2":2,"dcValue3":2,"dcValue4":1,"dcValue5":"boolean","dcValue6":2,"dcValue7":2,"dcValue8":1,"dcValue9":1,"dcValue10":1}]},{"file":"/var/www/html/lib/public/AppFramework/Db/QBMapper.php","line":116,"function":"executeStatement","class":"OC\\DB\\QueryBuilder\\QueryBuilder","type":"->","args":[]},{"file":"/var/www/html/custom_apps/richdocuments/lib/Db/WopiMapper.php","line":86,"function":"insert","class":"OCP\\AppFramework\\Db\\QBMapper","type":"->","args":[{"__class__":"OCA\\Richdocuments\\Db\\Wopi","id":null}]},{"file":"/var/www/html/custom_apps/richdocuments/lib/Service/SettingsService.php","line":152,"function":"generateUserSettingsToken","class":"OCA\\Richdocuments\\Db\\WopiMapper","type":"->","args":[-1,"admin","25.04.3.1","https://REDACTED"]},{"file":"/var/www/html/custom_apps/richdocuments/lib/Controller/WopiController.php","line":1001,"function":"generateIframeToken","class":"OCA\\Richdocuments\\Service\\SettingsService","type":"->","args":["user","admin"]},{"file":"/var/www/html/custom_apps/richdocuments/lib/Controller/WopiController.php","line":184,"function":"generateSettingToken","class":"OCA\\Richdocuments\\Controller\\WopiController","type":"->","args":["admin"]},{"file":"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php","line":200,"function":"checkFileInfo","class":"OCA\\Richdocuments\\Controller\\WopiController","type":"->","args":["34479864","c6bIet6Y7W1jBYciVbm67rrOXCVEOZKC"]},{"file":"/var/www/html/lib/private/AppFramework/Http/Dispatcher.php","line":114,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[{"__class__":"OCA\\Richdocuments\\Controller\\WopiController"},"checkFileInfo"]},{"file":"/var/www/html/lib/private/AppFramework/App.php","line":161,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->","args":[{"__class__":"OCA\\Richdocuments\\Controller\\WopiController"},"checkFileInfo"]},{"file":"/var/www/html/lib/private/Route/Router.php","line":307,"function":"main","class":"OC\\AppFramework\\App","type":"::","args":["OCA\\Richdocuments\\Controller\\WopiController","checkFileInfo",{"__class__":"OC\\AppFramework\\DependencyInjection\\DIContainer"},{"fileId":"34479864_ocf0b57c7cb0","_route":"richdocuments.wopi.checkfileinfo"}]},{"file":"/var/www/html/lib/base.php","line":1040,"function":"match","class":"OC\\Route\\Router","type":"->","args":["/apps/richdocuments/wopi/files/34479864_ocf0b57c7cb0"]},{"file":"/var/www/html/index.php","line":24,"function":"handleRequest","class":"OC","type":"::","args":[]}],"File":"/var/www/html/lib/private/DB/Exceptions/DbalException.php","Line":56,"Previous":{"Exception":"Doctrine\\DBAL\\Exception\\DriverException","Message":"An exception occurred while executing a query: SQLSTATE[22003]: Numeric value out of range: 1264 Out of range value for column 'fileid' at row 1","Code":1264,"Trace":[{"file":"/var/www/html/3rdparty/doctrine/dbal/src/Connection.php","line":1976,"function":"convert","class":"Doctrine\\DBAL\\Driver\\API\\MySQL\\ExceptionConverter","type":"->","args":[{"__class__":"Doctrine\\DBAL\\Driver\\PDO\\Exception"},{"__class__":"Doctrine\\DBAL\\Query"}]},{"file":"/var/www/html/3rdparty/doctrine/dbal/src/Connection.php","line":1918,"function":"handleDriverException","class":"Doctrine\\DBAL\\Connection","type":"->","args":[{"__class__":"Doctrine\\DBAL\\Driver\\PDO\\Exception"},{"__class__":"Doctrine\\DBAL\\Query"}]},{"file":"/var/www/html/3rdparty/doctrine/dbal/src/Connection.php","line":1218,"function":"convertExceptionDuringQuery","class":"Doctrine\\DBAL\\Connection","type":"->","args":[{"__class__":"Doctrine\\DBAL\\Driver\\PDO\\Exception"},"INSERT INTO `oc_richdocuments_wopi` (`fileid`, `owner_uid`, `editor_uid`, `version`, `canwrite`, `server_host`, `token`, `expiry`, `template_id`, `token_type`) VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?)",[-1,"admin","admin",25,true,"https://REDACTED/","4Idm1Ke2qLMRT3AIvuawxsUxDqmX2lY1",1751010777,0,5],[1,2,2,1,"boolean",2,2,1,1,1]]},[...]

Not exactly readable, but I guessed that the database rejected the fileid = -1 assignment into oc_richdocuments_wopi table after some hours.

And indeed
ALTER TABLE oc_richdocuments_wopi MODIFY fileid bigint(20) signed Not Null; made the issue go away. The field was unsigned before.
I guess that -1 is not a valid file_id, but next to a few entries with a positive file_id, I see lots of -1 generated into oc_richdocuments_wopi.

This may or may not be a valid fix.

please be aware AiO doesn’t user built-in Collabora but a separated CODE container (but configured on same cloud URL which causes confusion sometimes)

I’m having hard time to follow the problem - what is the effective issue? please review Collabora integration guide

The issue was a 500 that CODE received from richdocuments on its WOPI request to access the document to be edited.

It was caused by the database rejecting an entry into the oc_richdocuments_wopi table with fileid = -1 as the field was declared unsigned bigint(20) not null. Tweaking the database schema to allow signed integers fixed the issue for me.

I was writing this here hoping that
(a) it might help someone who runs into a similar issue
(b) get information from the devs whether or not this is the right fix
(c) it may contribute to fixing a bug somehwere

PS: The integration guide (as well as a lot of other documents) was studied carefully. Somehow it failed to document the fact that your database may reject entries with fileid = -1 into the oc_richdocuments_wopi table which may be an issue with the DB schema or an issue with richdocuments or with CODE trying to generate such entries in the first place.

1 Like

Thank you for clarification and very glad you solved the problem. Still wondering how fileid = -1 could occur..

The irony is, that a lot of people are experiencing issues with the field being signed and are currently switching everything to being unsigned: Numeric value out of range: 1264 Out of range value for column 'fileid' at row 1 · Issue #4597 · nextcloud/richdocuments · GitHub

Indeed, I have run into same issue as #4597. I had done this occ richdocuments:convert-bigint thing recently and that probably was what broke Collabora. At least my version 25.04.3.1 still(?) seems to use and need -1. Too bad I had not found this Issue…

1 Like

This topic was automatically closed 8 days after the last reply. New replies are no longer allowed.