Skip to content

Bug: "userId not set" error when creating new document from template on Android app #5275

@bzzbaishy

Description

@bzzbaishy

Description
Summary: When attempting to create a new document using a template via the Nextcloud Android app, the operation fails with a "Failed to generate token" error. The server log reveals a OCP\Files\NotFoundException with the message userId not set. However, creating a blank document or editing an existing document works perfectly.

Environment:

Nextcloud Version: 32.0.5

Nextcloud Office (richdocuments) Version: 32.0.5.0 (as per logs)

Android App Version: 3.34.1

Collabora Online / Built-in CODE: (Please mention if you are using Built-in CODE or a standalone server)

Steps to Reproduce:

Open the Nextcloud Android app.

Navigate to a folder and tap the "+" button to create a new document.

Select any template (e.g., Invoice.odt or Calendar.odt) instead of "Blank".

Enter a filename and tap "Create".

The error "Failed to generate token for existing file on direct editing" appears.

Expected Behavior: The app should successfully initialize the file from the template and open the editor.

Actual Behavior: The file is not created, and the server logs an exception indicating that the userId is missing during the TemplateManager call.

Server Logs
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":".../richdocuments/lib/TemplateManager.php","line":139,"function":"getUserTemplateDir"}
]
}
}
(Full log attached in the original post)

Additional Context
Web UI works fine: Creating the same document from the same template via a web browser works without issues.

Editing works fine: If I create the document on the Web UI first, I can open and edit it on the Android app without any errors.

Personal Templates: The template directory is correctly set in "Personal Settings -> Nextcloud Office".

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