Post Body
Summary: I am encountering a persistent error when trying to create new documents using templates via the Nextcloud Android app. While creating a blank document or editing existing files works perfectly, selecting any template results in a “Failed to generate token” error.
Steps to Reproduce:
-
Open the Nextcloud Android app (v3.34.1).
-
Use the “+” button to create a new document.
-
Choose a template (e.g.,
Invoice.odtorCalendar.odt) from the “New Document” picker. -
Set a filename and tap “Create”.
-
Error occurs: “Failed to generate token for existing file on direct editing”.
Observed Behavior:
-
Android App: Fails when using templates.
-
Web UI: Works perfectly with the exact same templates.
-
Editing: Once a file is created (even via template on Web), it can be opened and edited on Android without issues.
Environment:
-
Nextcloud Version: 32.0.5.0
-
Richdocuments (Nextcloud Office) Version: 32.0.5.0
-
Android App: 3.34.1
-
Template Setup: Templates are stored in a dedicated folder and correctly linked in “Personal Settings → Nextcloud Office” (verified by successful Web UI usage).
Error Log (Nextcloud.log):
JSON
{
"reqId":"tqXJPhjVPxuAsV84TtnL",
"level":3,
"app":"richdocuments",
"message":"Failed to generate token for existing file on direct editing",
"exception":{
"Exception":"OCP\\Files\\NotFoundException",
"Message":"userId not set",
"Trace":[
{"file":"/var/www/html/custom_apps/richdocuments/lib/TemplateManager.php","line":139,"function":"getUserTemplateDir"}
]
}
}
What I’ve tried:
-
Re-selecting the template folder in personal settings.
-
Running
occ files:scan --all. -
Verifying that the templates folder is accessible and contains valid files.
It seems like the userId session is not properly passed when the Android app specifically requests a file creation based on a template. Has anyone encountered this or found a workaround in the config.php or Nginx settings?