NextCloud Office not loading in App
β οΈ Before posting β οΈ
- [x] This is a bug, not a question or an enhancement.
- [x] I've searched for similar issues and didn't find a duplicate.
- [x] I've written a clear and descriptive title for this issue, not just "Bug" or "Crash".
- [x] I agree to follow Nextcloud's Code of Conduct.
Steps to reproduce
Steps to reproduce:
- Try accessing any .docx or .xlsx file within the NextCloud app.
- NextCloud Office will attempt to load. It will be stuck indefinitely loading, never rendering the file.
Expected behaviour
The app opens NextCloud Collabora office, renders my documents and I'm able to edit the files. This was the behaviour before the 34.0.X updates.
Actual behaviour
The NextCloud app hangs on a forever loading loop. Doesn't give me any errors, just "This is taking longer than expected".
Android version
OneUI 8.0, Android 16
Device brand and model
Samsung Galaxy S22 Ultra
Stock or custom OS?
Stock
Nextcloud android app version
34.0.1
Nextcloud server version
34.0.1
Using a reverse proxy?
Yes
Android logs
No response
Server error logs
Additional information
Collabora CODE Docker Server version 26.04.1.4
In the Collabora CODE Admin panel, the Collabora server identifies that it is opening the requested file and is rendering the document, just does not appear in the app.
Document rendering does work fine in a Browser, even a mobile browser. I did make sure it was not a fault of the Reverse Proxy Settings.
As for why no Android Logs. I couldn't find the requested log files in my phone. Either Samsung hides it or I just couldn't find it. I apologize.
I can confirm the same issue.
Environment:
- Nextcloud Android: 34.0.1
- Nextcloud Server: 34.0.0.12
- richdocuments: 11.0.0
- Collabora CODE: 26.04.1.4
- nginx reverse proxy
The server-side flow completes successfully:
- POST /ocs/v2.php/apps/files/api/v1/directEditing/open -> 200
- GET /apps/files/directEditing/{token} -> 200
- WOPI CheckFileInfo -> 200
- WOPI file contents -> 200
- Collabora successfully loads and renders the document
- No relevant errors appear in Nextcloud or Collabora logs
The Android app remains stuck on βThis is taking longer than expectedβ.
The same DOCX opens successfully in Chrome on the same Android phone, using the same mobile connection. Clearing the Nextcloud app cache did not help.
Unknown whether it is on the Android app's side, or the richdocument's side, but posting this here for further reference: https://github.com/nextcloud/richdocuments/issues/5756. Seems like it might be related to the same issue.
I have same issue with ods/odt AND pdf. Images and video opening fine.
I have same issue with ods/odt AND pdf. Images and video opening fine.
I confim, I have same issue
A Small update from me:
I opened this issue under the Android App as it only affected the Android App, but it may be closely related with a richdocument bug. Seems both the iOS and Android apps are experiencing this exact issue.
I'll keep this open unless a developer wishes to close this under the fact it may be a richdocument issue, not an Android App issue.
Related: https://github.com/nextcloud/richdocuments/issues/5758
This also seems to only happen if you use an external Collabora CODE server, though I cannot confirm on that one since I swapped from using the Built-In version as I was having different errors with that which were fixed when I swapped to a Docker Version.
Funny story actually. Spent quite the hours of work using Gemini and some obvious network stack fixes - only to find out, it's an actual bug. Thanks for documenting!
I am experiencing the exact same endless loading loop when trying to open Office documents (.xlsx / .docx) inside the native Android app. It works perfectly when using a mobile browser on the same device.
Environment
- Nextcloud Version: AIO (Latest)
- Proxy: Nginx Proxy Manager (NPM)
- DNS: AdGuard Home (Local DNS Rewrite to proxy IP)
Log trace
When monitoring the logs live with php occ log:watch while triggering the bug from the mobile app, I catch the following fatale PHP crash:
root@files:~# docker exec --user www-data nextcloud-aio-nextcloud php occ log:watch
Error index Exception: fclose(): 2026-07-04T03:49:48+00:00
supplied resource is
not a valid stream
resource in file
'/var/www/html/custom_apps/richdocuments/lib/Service/RemoteService.php'
line 73 at
lib/private/AppFramework/Http/Dispatcher.php
line 110
0. .../App.php line 137
OC\AppFramework\Http\Dispatcher->dispatch(
OC\Cor ... {},
... d"
)
1. .../Router.php line 324
OC\AppFramework\App::main(
"OC\\Core\\Controller\\P ... r",
"ge ... d",
OC\AppFramework\DependencyInjecti ... {},
{_route:"core.preview.get ... "}
)
2. .../base.php line 1159
OC\Route\Router->match(
"\/ ... w"
)
3. index.php line 25
OC::handleRequest()
Caused by TypeError: fclose():
supplied resource is
not a valid stream
resource at
.../richdocuments/lib/Service/RemoteService.php
line 73
0. .../RemoteService.php line 73
fclose(" ... *")
1. .../Office.php line 56
OCA\Richdocuments\Service\RemoteService->convertFileTo(
... {},
... g",
... 5
)
2. .../GeneratorHelper.php line 25
OCA\Richdocuments\Preview\Office->getThumbnail(
... {},
... 48,
... 48
)
3. .../Generator.php line 382
OC\Preview\GeneratorHelper->getThumbnail(
O ... {},
... {},
... 48,
... 48
)
4. .../Generator.php line 336
OC\Preview\Generator->generateProviderPreview(
... {},
... 48,
... 48,
... se,
... ue,
"application\/vnd.openxmlforma ... t",
... ll
)
5. .../Generator.php line 127
OC\Preview\Generator->getMaxPreview(
... [],
... {},
"application\/vnd.openxmlformats-officed ... t",
... ll
)
6. .../Generator.php line 95
OC\Preview\Generator->generatePreviews(
... {},
[{width:32,he ... }],
"application\/vnd.openxmlformats-offi ... t",
... ue
)
7. .../PreviewManager.php line 183
OC\Preview\Generator->getPreview(
... {},
... 32,
... 32,
... ue,
... l",
... ll,
... ue
)
8. .../PreviewController.php line 166
OC\PreviewManager->getPreview(
... {},
... 32,
... 32,
... ue,
... l"
)
9. .../PreviewController.php line 128
OC\Core\Controller\PreviewController->fetchPreview(
... {},
... 32,
... 32,
... se,
... ue,
... l",
... ue
)
10. .../Dispatcher.php line 165
OC\Core\Controller\PreviewController->getPreviewByFileId(
... 80,
... 32,
... 32,
... se,
... ue,
... l",
... ue
)
11. .../Dispatcher.php line 78
OC\AppFramework\Http\Dispatcher->executeController(
... {},
... d"
)
12. .../App.php line 137
OC\AppFramework\Http\Dispatcher->dispatch(
OC\Co ... {},
... d"
)
13. .../Router.php line 324
OC\AppFramework\App::main(
"OC\\Core\\Controller\\ ... r",
"g ... d",
OC\AppFramework\DependencyInject ... {},
{_route:"core.preview.ge ... "}
)
14. .../base.php line 1159
OC\Route\Router->match(
"\ ... w"
)
15. index.php line 25
OC::handleRequest()
Error index Exception: fclose(): 2026-07-04T03:50:37+00:00
supplied resource is
not a valid stream
resource in file
'/var/www/html/custom_apps/richdocuments/lib/Service/RemoteService.php'
line 73 at
lib/private/AppFramework/Http/Dispatcher.php
line 110
0. .../App.php line 137
OC\AppFramework\Http\Dispatcher->dispatch(
OC\Cor ... {},
... d"
)
1. .../Router.php line 324
OC\AppFramework\App::main(
"OC\\Core\\Controller\\P ... r",
"ge ... d",
OC\AppFramework\DependencyInjecti ... {},
{_route:"core.preview.get ... "}
)
2. .../base.php line 1159
OC\Route\Router->match(
"\/ ... w"
)
3. index.php line 25
OC::handleRequest()
Caused by TypeError: fclose():
supplied resource is
not a valid stream
resource at
.../richdocuments/lib/Service/RemoteService.php
line 73
0. .../RemoteService.php line 73
fclose(" ... *")
1. .../Office.php line 56
OCA\Richdocuments\Service\RemoteService->convertFileTo(
... {},
... g",
... 5
)
2. .../GeneratorHelper.php line 25
OCA\Richdocuments\Preview\Office->getThumbnail(
... {},
... 48,
... 48
)
3. .../Generator.php line 382
OC\Preview\GeneratorHelper->getThumbnail(
O ... {},
... {},
... 48,
... 48
)
4. .../Generator.php line 336
OC\Preview\Generator->generateProviderPreview(
... {},
... 48,
... 48,
... se,
... ue,
"application\/vnd.openxmlforma ... t",
... ll
)
5. .../Generator.php line 127
OC\Preview\Generator->getMaxPreview(
... [],
... {},
"application\/vnd.openxmlformats-officed ... t",
... ll
)
6. .../Generator.php line 95
OC\Preview\Generator->generatePreviews(
... {},
[{width:250,hei ... }],
"application\/vnd.openxmlformats-offi ... t",
... ue
)
7. .../PreviewManager.php line 183
OC\Preview\Generator->getPreview(
... {},
... 50,
... 50,
... ue,
... l",
... ll,
... ue
)
8. .../PreviewController.php line 166
OC\PreviewManager->getPreview(
... {},
... 50,
... 50,
... ue,
... l"
)
9. .../PreviewController.php line 128
OC\Core\Controller\PreviewController->fetchPreview(
... {},
... 50,
... 50,
... se,
... ue,
... l",
... se
)
10. .../Dispatcher.php line 165
OC\Core\Controller\PreviewController->getPreviewByFileId(
... 80,
... 50,
... 50,
... se,
... ue,
... l",
... se
)
11. .../Dispatcher.php line 78
OC\AppFramework\Http\Dispatcher->executeController(
... {},
... d"
)
12. .../App.php line 137
OC\AppFramework\Http\Dispatcher->dispatch(
OC\Co ... {},
... d"
)
13. .../Router.php line 324
OC\AppFramework\App::main(
"OC\\Core\\Controller\\ ... r",
"g ... d",
OC\AppFramework\DependencyInject ... {},
{_route:"core.preview.ge ... "}
)
14. .../base.php line 1159
OC\Route\Router->match(
"\ ... w"
)
15. index.php line 25
OC::handleRequest()
I can add a data point that pins down where this breaks.
Setup: Nextcloud 34.0.0.12 (Docker), richdocuments 11.0.0, Collabora Online 26.04.1.4.1 (own Docker container, not built-in CODE), reverse proxy via Nginx Proxy Manager. Android app 34.0.1 on Pixel 6a / Android 16.
Symptom: Identical to OP β opening any document (tested with PDF and XLSX) in the Android app shows "loading is taking longer than expected" and never completes. Opening the exact same document via a desktop browser (Firefox) or the Windows desktop client works instantly, every time, with the same Collabora server.
I went through the reverse-proxy access log for both a working (browser) and a failing (app) session, filtered to colla.<domain>:
Working session (browser), same file:
GET /browser/.../cool.html?WOPISrc=... 200
GET /browser/.../src/app/TaskWorker.js 200
GET /browser/.../src/app/TaskWorker.js 200
GET /browser/.../src/app/TaskWorker.js 200
GET /cool/ws?WOPISrc=... 101 <-- WebSocket upgrade succeeds
GET /browser/.../bundle.js 200
... (rest of UI assets load normally)
Failing session (Android app), same file:
GET /browser/.../cool.html?WOPISrc=... 200
GET /browser/.../src/app/TaskWorker.js 200
GET /browser/.../src/app/TaskWorker.js 200
GET /browser/.../src/app/TaskWorker.js 200
GET /browser/.../src/app/TaskWorker.js 200
...and then nothing. No /cool/ws request ever appears. The app just keeps re-requesting TaskWorker.js and never proceeds to the WebSocket upgrade.
The Nextcloud/Collabora side is fully healthy in this window β the WOPI handshake (wopi/files/..., wopi/settings/..., file contents GET) all complete with 200s before this point, and the Collabora server logs show no errors for this session. wopi_allowlist is empty, wopi_url/public_wopi_url correctly point to the public Collabora domain, and NPM has websocket support + the standard /cool/ location block with proxy_http_version 1.1 / Upgrade headers.
This strongly suggests the app's embedded WebView is failing to properly instantiate/hand off the TaskWorker.js (shared worker), and never reaches the point where it opens the /cool/ws connection β while a real browser (mobile or desktop) handles the same worker script and proceeds normally.
(Disclosure: the log analysis and diagnosis above were done with the help of an AI assistant, working from logs I provided and directed it to pull β I'm posting it here because the finding looked concrete and reproducible, not because I traced the WebView internals myself.)
Happy to provide other logs if useful for debugging.
Hey all!
So, it was an issue with Richtextdocument after all. Richtextdocument got an update sometimes in the last few days or so (or even today), and has resolved the issue. I will be closing the ticket. Thanks for everyone's sanity check that it wasn't just me!
I can confirm that with the release v11.0.1 the android app does actually open the files again.
It seems like it was this PR that solved the problem: https://github.com/nextcloud/richdocuments/pull/5805
My Claud-Sonnet did nor come to the conclusion to look into the richdocuments app for the bugπ
Oh joy! It works again. :) Thanks - whoever did the fix :)
another point of view, if somebody had the same problem:
SOLVED: "Starting the built-in CODE server is taking longer than expected" with bundled richdocumentscode (no Docker)
Environment: Ubuntu server, Nextcloud 34.0.3, bare-metal Apache2 + mod_php (no Docker), richdocuments 10.x + bundled richdocumentscode (x86_64 AppImage, not richdocumentscode_arm64), Nextcloud behind a home router with a dynamic public domain.
Symptom: Opening any Office document (xlsx/docx/...) in the browser shows the loading spinner, then after ~30s fails with:
Starting the built-in CODE server is taking longer than expected
This is a dead end everywhere I searched β lots of people hitting it, no working fix reported anywhere. Turned out to be three separate, unrelated problems stacked on top of each other, all hidden behind that one generic message. Posting the full chain in case it saves someone else the multi-hour dig.
Cause 1 β no real editor backend installed
If you only have the office app enabled, that's just a dashboard/overview page, not an editor. You need both:
occ app:install richdocuments
occ app:install richdocumentscode
(richdocumentscode_arm64 on ARM boards like a Raspberry Pi.)
Cause 2 β www-data's home directory isn't writable
The bundled coolwsd process runs as www-data. On startup it tries to write a LibreOffice profile/temp file to www-data's home directory β which on stock Debian/Ubuntu defaults to /var/www, owned by root and not writable by www-data. The coolwsd network process itself comes up fine (so it looks healthy β it accepts connections, discovery.xml even works), but the actual document-rendering engine fails to bootstrap silently.
Tell-tale sign in /var/log/apache2/error.log:
mkstemp("/var/www/.execoXXXXXX") failed: Permission denied
Bootstrapping exception 'Extension Manager: exception during enableExtension'
Fix: give www-data its own writable home directory (needs Apache stopped briefly, since usermod refuses to touch a user with running processes):
sudo systemctl stop apache2
sudo mkdir -p /var/lib/www-data
sudo chown www-data:www-data /var/lib/www-data
sudo chmod 750 /var/lib/www-data
sudo usermod -d /var/lib/www-data www-data
sudo systemctl start apache2
# kill the already-running (broken) coolwsd so it respawns with the new HOME
sudo pkill -9 -f coolwsd
sudo pkill -9 -f Collabora_Online.AppImage
sudo pkill -9 -f coolforkit
After this, /var/log/apache2/error.log should show Ready to accept connections on port 9983. with no more mkstemp/bootstrapping errors (a bunch of harmless Fontconfig error: No writable cache directories warnings before that line are fine, not fatal).
Cause 3 β stale cached discovery.xml
Even with 1+2 fixed, document loading can still fail with:
Call to a member function xpath() on false in file '.../richdocuments/lib/WOPI/Parser.php' line 42
richdocuments caches the WOPI "discovery.xml" (the capabilities list fetched from the CODE server) rather than fetching it on every request. If it ever cached an empty/failed discovery response (e.g. from before Cause 1/2 were fixed, or from any earlier network hiccup), it keeps serving that broken cached value indefinitely β even though a manual curl to the same discovery URL now works perfectly fine. xpath() on that false value throws, and the frontend just shows the generic timeout message.
Fix: force a fresh fetch/cache:
sudo -u www-data php /var/www/nextcloud/occ richdocuments:activate-config
Diagnostic checklist (fastest path to root cause)
ps aux | grep -i coolβ iscoolwsdactually running?tail -80 /var/log/apache2/error.logβ look formkstemp/Permission denied/Bootstrapping exception(β Cause 2) vs. a cleanReady to accept connections on port 9983.- Browser DevTools β Network tab β reproduce β look for any red/failed request, especially one named
token(POST to.../apps/richdocuments/token) andproxy.php?status. - If
tokenis 500:tail -100 /var/www/nextcloud/data/nextcloud.log | grep -B2 -A25 -i exceptionand look for the exact PHP exception (β Cause 3 if it's thexpath() on falseone). - If everything above looks clean but it still fails from the browser while
curlto the same URLs succeeds from the server: check for split-horizon DNS / NAT hairpin issues if you're accessing Nextcloud via a public domain that also happens to be your own server's public IP (self-requests looping out through your router and back can fail or hit the router's own admin/remote-access service instead of your server). A local/etc/hostsoverride (public domain β 127.0.0.1 or LAN IP) on the server fixes PHP-backend-side calls to itself.
Side note: wopi_url vs public_wopi_url
richdocuments supports setting these separately: wopi_url for internal server-to-CODE communication (can point at localhost/LAN, avoiding any external routing weirdness) and public_wopi_url for the URLs actually loaded by the browser (needs to be reachable by clients, matching scheme to avoid mixed-content). If you only set wopi_url, both internal and external calls use the same host, which is fine as long as that host is reliably reachable from both the server itself and from client browsers β but explicitly splitting them is more robust for setups with dynamic public domains behind a home router.