Skip to content

[Bug]: "Failed to create Templates directory" error when logging in for the first time with a Guest account #54063

@SebastianKrupinski

Description

@SebastianKrupinski

⚠️ This issue respects the following points: ⚠️

Bug description

The issue seems to be when the user has a space quota of 0, the templates can not be copied.

{
    "reqId": "Kr0yPTfQWPKASDCVem5J",
    "level": 3,
    "time": "2025-07-07T16:02:50+02:00",
    "remoteAddr": "x.x.x.x",
    "user": "[email protected]",
    "app": "files_templates",
    "method": "POST",
    "url": "/login",
    "message": "Failed to initialize templates directory to user language en for [email protected]",
    "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36 Edg/136.0.0.0",
    "version": "31.0.6.3",
    "exception": {
        "Exception": "OCP\\Files\\NotPermittedException",
        "Message": "Could not create folder \"/[email protected]/files/./Templates\"",
        "Code": 0,
        "Trace": [
            {
                "file": "/data/nextcloud/lib/private/Files/Template/TemplateManager.php",
                "line": 367,
                "function": "newFolder",
                "class": "OC\\Files\\Node\\Folder",
                "type": "->"
            },
            {
                "file": "/data/nextcloud/lib/private/legacy/OC_Util.php",
                "line": 166,
                "function": "initializeTemplateDirectory",
                "class": "OC\\Files\\Template\\TemplateManager",
                "type": "->"
            },
            {
                "file": "/data/nextcloud/lib/private/User/Session.php",
                "line": 521,
                "function": "copySkeleton",
                "class": "OC_Util",
                "type": "::"
            },
            {
                "file": "/data/nextcloud/lib/private/User/Session.php",
                "line": 357,
                "function": "prepareUserLogin",
                "class": "OC\\User\\Session",
                "type": "->"
            },
            {
                "file": "/data/nextcloud/lib/private/Authentication/Login/CompleteLoginCommand.php",
                "line": 22,
                "function": "completeLogin",
                "class": "OC\\User\\Session",
                "type": "->",
                "args": [
                    "*** sensitive parameters replaced ***"
                ]
            },
            {
                "file": "/data/nextcloud/lib/private/Authentication/Login/ALoginCommand.php",
                "line": 22,
                "function": "process",
                "class": "OC\\Authentication\\Login\\CompleteLoginCommand",
                "type": "->"
            },
            {
                "file": "/data/nextcloud/lib/private/Authentication/Login/LoggedInCheckCommand.php",
                "line": 41,
                "function": "processNextOrFinishSuccessfully",
                "class": "OC\\Authentication\\Login\\ALoginCommand",
                "type": "->"
            },
            {
                "file": "/data/nextcloud/lib/private/Authentication/Login/ALoginCommand.php",
                "line": 22,
                "function": "process",
                "class": "OC\\Authentication\\Login\\LoggedInCheckCommand",
                "type": "->"
            },
            {
                "file": "/data/nextcloud/lib/private/Authentication/Login/EmailLoginCommand.php",
                "line": 51,
                "function": "processNextOrFinishSuccessfully",
                "class": "OC\\Authentication\\Login\\ALoginCommand",
                "type": "->"
            },
            {
                "file": "/data/nextcloud/lib/private/Authentication/Login/ALoginCommand.php",
                "line": 22,
                "function": "process",
                "class": "OC\\Authentication\\Login\\EmailLoginCommand",
                "type": "->"
            },
            {
                "file": "/data/nextcloud/lib/private/Authentication/Login/UidLoginCommand.php",
                "line": 36,
                "function": "processNextOrFinishSuccessfully",
                "class": "OC\\Authentication\\Login\\ALoginCommand",
                "type": "->"
            },
            {
                "file": "/data/nextcloud/lib/private/Authentication/Login/ALoginCommand.php",
                "line": 22,
                "function": "process",
                "class": "OC\\Authentication\\Login\\UidLoginCommand",
                "type": "->"
            },
            {
                "file": "/data/nextcloud/lib/private/Authentication/Login/UserDisabledCheckCommand.php",
                "line": 39,
                "function": "processNextOrFinishSuccessfully",
                "class": "OC\\Authentication\\Login\\ALoginCommand",
                "type": "->"
            },
            {
                "file": "/data/nextcloud/lib/private/Authentication/Login/ALoginCommand.php",
                "line": 22,
                "function": "process",
                "class": "OC\\Authentication\\Login\\UserDisabledCheckCommand",
                "type": "->"
            },
            {
                "file": "/data/nextcloud/lib/private/Authentication/Login/PreLoginHookCommand.php",
                "line": 34,
                "function": "processNextOrFinishSuccessfully",
                "class": "OC\\Authentication\\Login\\ALoginCommand",
                "type": "->"
            },
            {
                "file": "/data/nextcloud/lib/private/Authentication/Login/Chain.php",
                "line": 45,
                "function": "process",
                "class": "OC\\Authentication\\Login\\PreLoginHookCommand",
                "type": "->"
            },
            {
                "file": "/data/nextcloud/core/Controller/LoginController.php",
                "line": 344,
                "function": "process",
                "class": "OC\\Authentication\\Login\\Chain",
                "type": "->"
            },
            {
                "file": "/data/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
                "line": 200,
                "function": "tryLogin",
                "class": "OC\\Core\\Controller\\LoginController",
                "type": "->",
                "args": [
                    "*** sensitive parameters replaced ***"
                ]
            },
            {
                "file": "/data/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
                "line": 114,
                "function": "executeController",
                "class": "OC\\AppFramework\\Http\\Dispatcher",
                "type": "->"
            },
            {
                "file": "/data/nextcloud/lib/private/AppFramework/App.php",
                "line": 161,
                "function": "dispatch",
                "class": "OC\\AppFramework\\Http\\Dispatcher",
                "type": "->"
            },
            {
                "file": "/data/nextcloud/lib/private/Route/Router.php",
                "line": 307,
                "function": "main",
                "class": "OC\\AppFramework\\App",
                "type": "::"
            },
            {
                "file": "/data/nextcloud/lib/base.php",
                "line": 1040,
                "function": "match",
                "class": "OC\\Route\\Router",
                "type": "->"
            },
            {
                "file": "/data/nextcloud/index.php",
                "line": 24,
                "function": "handleRequest",
                "class": "OC",
                "type": "::"
            }
        ],
        "File": "/data/nextcloud/lib/private/Files/Node/Folder.php",
        "Line": 132,
        "message": "Failed to initialize templates directory to user language en for [email protected]",
        "exception": {},
        "CustomMessage": "Failed to initialize templates directory to user language en for [email protected]"
    }
}

Steps to reproduce

  1. Install guest app and at least one file editor (e.g. NC text)
  2. Create guest access to a folder
  3. Login as the guest
  4. See error in log

Expected behavior

No errors

Nextcloud Server version

master

Operating system

Debian/Ubuntu

PHP engine version

PHP 8.2

Web server

Nginx

Database engine version

MariaDB

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

None

Are you using the Nextcloud Server Encryption module?

None

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 roadmap32-feedbackbug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions