# Internal server error, Can't accesses files

**URL:** <https://help.nextcloud.com/t/internal-server-error-cant-accesses-files/215691>\
**Category:** ℹ️ Support\
**Tags:** docker, nc30, setup\_warning\
**Created:** [January 23, 2025, 12:20am UTC](https://help.nextcloud.com/t/internal-server-error-cant-accesses-files/215691 "2025-01-23T00:20:30Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![peglegtv](https://help.nextcloud.com/letter_avatar/peglegtv/32/5_5575768a8748004e209b776fc1b2916d.png) [@peglegtv](https://help.nextcloud.com/u/peglegtv)\
**Post date:** [January 23, 2025, 12:20am UTC](https://help.nextcloud.com/t/internal-server-error-cant-accesses-files/215691/1 "2025-01-23T00:20:30Z")

</div>

Issue: when trying to accesses files on my account (admin) I get an Internal server error. it only happens when selecting files. I tested another account and that account works fine.

Internal Server error:

 ![Screenshot 2025-01-22 151254](https://help.nextcloud.com/uploads/default/original/3X/0/b/0b5bb9cdcc6f13837f5cc0c6ad3f529e7ad14855.png)

formatted log entry:

```auto
[index] Error: Object of class OC\Files\Node\File could not be converted to string in file '/var/www/html/lib/private/Files/Template/TemplateManager.php' line 182
   GET /index.php/apps/files/
   from 172.24.0.1 by peglegtv at Jan 22, 2025, 2:51:49 PM

```

Raw log entry:

```json
{
  "reqId": "uiYxJJKrzNsS438vWPxZ",
  "level": 3,
  "time": "2025-01-22T20:51:49+00:00",
  "remoteAddr": "172.24.0.1",
  "user": "peglegtv",
  "app": "index",
  "method": "GET",
  "url": "/index.php/apps/files/",
  "message": "Object of class OC\\Files\\Node\\File could not be converted to string in file '/var/www/html/lib/private/Files/Template/TemplateManager.php' line 182",
  "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36",
  "version": "30.0.5.1",
  "exception": {
    "Exception": "Exception",
    "Message": "Object of class OC\\Files\\Node\\File could not be converted to string in file '/var/www/html/lib/private/Files/Template/TemplateManager.php' line 182",
    "Code": 0,
    "Trace": [
      {
        "file": "/var/www/html/lib/private/AppFramework/App.php",
        "line": 161,
        "function": "dispatch",
        "class": "OC\\AppFramework\\Http\\Dispatcher",
        "type": "->",
        "args": [
          {
            " __class__": "OCA\\Files\\Controller\\ViewController"
          },
          "index"
        ]
      },
      {
        "file": "/var/www/html/lib/private/Route/Router.php",
        "line": 302,
        "function": "main",
        "class": "OC\\AppFramework\\App",
        "type": "::",
        "args": [
          "OCA\\Files\\Controller\\ViewController",
          "index",
          {
            " __class__": "OC\\AppFramework\\DependencyInjection\\DIContainer"
          },
          {
            "_route": "files.view.index"
          }
        ]
      },
      {
        "file": "/var/www/html/lib/base.php",
        "line": 1003,
        "function": "match",
        "class": "OC\\Route\\Router",
        "type": "->",
        "args": [
          "/apps/files/"
        ]
      },
      {
        "file": "/var/www/html/index.php",
        "line": 24,
        "function": "handleRequest",
        "class": "OC",
        "type": "::",
        "args": []
      }
    ],
    "File": "/var/www/html/lib/private/AppFramework/Http/Dispatcher.php",
    "Line": 146,
    "Previous": {
      "Exception": "Error",
      "Message": "Object of class OC\\Files\\Node\\File could not be converted to string",
      "Code": 0,
      "Trace": [
        {
          "file": "/var/www/html/lib/private/Files/Template/TemplateManager.php",
          "line": 241,
          "function": "getTemplateFolder",
          "class": "OC\\Files\\Template\\TemplateManager",
          "type": "->",
          "args": []
        },
        {
          "file": "/var/www/html/apps/files/lib/Controller/ViewController.php",
          "line": 196,
          "function": "hasTemplateDirectory",
          "class": "OC\\Files\\Template\\TemplateManager",
          "type": "->",
          "args": []
        },
        {
          "file": "/var/www/html/lib/private/AppFramework/Http/Dispatcher.php",
          "line": 208,
          "function": "index",
          "class": "OCA\\Files\\Controller\\ViewController",
          "type": "->",
          "args": [
            "",
            "",
            null,
            false
          ]
        },
        {
          "file": "/var/www/html/lib/private/AppFramework/Http/Dispatcher.php",
          "line": 114,
          "function": "executeController",
          "class": "OC\\AppFramework\\Http\\Dispatcher",
          "type": "->",
          "args": [
            {
              " __class__": "OCA\\Files\\Controller\\ViewController"
            },
            "index"
          ]
        },
        {
          "file": "/var/www/html/lib/private/AppFramework/App.php",
          "line": 161,
          "function": "dispatch",
          "class": "OC\\AppFramework\\Http\\Dispatcher",
          "type": "->",
          "args": [
            {
              " __class__": "OCA\\Files\\Controller\\ViewController"
            },
            "index"
          ]
        },
        {
          "file": "/var/www/html/lib/private/Route/Router.php",
          "line": 302,
          "function": "main",
          "class": "OC\\AppFramework\\App",
          "type": "::",
          "args": [
            "OCA\\Files\\Controller\\ViewController",
            "index",
            {
              " __class__": "OC\\AppFramework\\DependencyInjection\\DIContainer"
            },
            {
              "_route": "files.view.index"
            }
          ]
        },
        {
          "file": "/var/www/html/lib/base.php",
          "line": 1003,
          "function": "match",
          "class": "OC\\Route\\Router",
          "type": "->",
          "args": [
            "/apps/files/"
          ]
        },
        {
          "file": "/var/www/html/index.php",
          "line": 24,
          "function": "handleRequest",
          "class": "OC",
          "type": "::",
          "args": []
        }
      ],
      "File": "/var/www/html/lib/private/Files/Template/TemplateManager.php",
      "Line": 182
    },
    "message": "Object of class OC\\Files\\Node\\File could not be converted to string in file '/var/www/html/lib/private/Files/Template/TemplateManager.php' line 182",
    "exception": [],
    "CustomMessage": "Object of class OC\\Files\\Node\\File could not be converted to string in file '/var/www/html/lib/private/Files/Template/TemplateManager.php' line 182"
  },
  "id": "67915c09d51c0"
}

```

Docker container, Version Nextcloud Hub 9 30.0.5  
running on OMV 6.9.16-1 (Shaitan)

What I’ve tried:

tried pulling a new image

```auto
docker exec -it --user www-data Nextcloud /var/www/html/occ files:scan-app-data

```

no errors found

```auto
docker exec -it --user www-data Nextcloud /var/www/html/occ maintenance:repair

```

```auto
docker exec -it --user www-data Nextcloud /var/www/html/occ files:scan peglegtv

```

no errors found

I’m at a loss, please help

---

<div class="post-metadata">

**Author:** ![ernolf](https://help.nextcloud.com/user_avatar/help.nextcloud.com/ernolf/32/77874_2.png) [@ernolf](https://help.nextcloud.com/u/ernolf)\
**Post date:** [January 23, 2025, 2:06am UTC](https://help.nextcloud.com/t/internal-server-error-cant-accesses-files/215691/2 "2025-01-23T02:06:24Z")

</div>

Hi @peglegtv,

> [@peglegtv](#):
>
> Raw log entry:
> 
> ```json
> {
> "reqId": "uiYxJJKrzNsS438vWPxZ",
> /../
> 
> ```

… but that is not the Request ID from the Internal Server Error Message.

So please post the output of

```sh
jq -r 'select(.reqId == "q7ZivWSDK9DxO3vU7t8q")' /path/to/nextcloud.log

```

* * *

ernolf

---

<div class="post-metadata">

**Author:** ![peglegtv](https://help.nextcloud.com/letter_avatar/peglegtv/32/5_5575768a8748004e209b776fc1b2916d.png) [@peglegtv](https://help.nextcloud.com/u/peglegtv)\
**Post date:** [January 23, 2025, 5:00am UTC](https://help.nextcloud.com/t/internal-server-error-cant-accesses-files/215691/3 "2025-01-23T05:00:20Z")

</div>

@ernolf thanks for the reply.

sorry the image and log didn’t match, I grabbed the screen shot as an example of the messages I was getting.

output from `jq -r 'select(.reqId == "q7ZivWSDK9DxO3vU7t8q")' /path/to/nextcloud.log`

```auto
{
  "reqId": "q7ZivWSDK9DxO3vU7t8q",
  "level": 3,
  "time": "2025-01-22T21:12:40+00:00",
  "remoteAddr": "192.168.1.1",
  "user": "peglegtv",
  "app": "index",
  "method": "GET",
  "url": "/index.php/apps/files/",
  "message": "Object of class OC\\Files\\Node\\File could not be converted to string in file '/var/www/html/lib/private/Files/Template/TemplateManager.php' line 182",
  "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36",
  "version": "30.0.5.1",
  "exception": {
    "Exception": "Exception",
    "Message": "Object of class OC\\Files\\Node\\File could not be converted to string in file '/var/www/html/lib/private/Files/Template/TemplateManager.php' line 182",
    "Code": 0,
    "Trace": [
      {
        "file": "/var/www/html/lib/private/AppFramework/App.php",
        "line": 161,
        "function": "dispatch",
        "class": "OC\\AppFramework\\Http\\Dispatcher",
        "type": "->",
        "args": [
          {
            " __class__": "OCA\\Files\\Controller\\ViewController"
          },
          "index"
        ]
      },
      {
        "file": "/var/www/html/lib/private/Route/Router.php",
        "line": 302,
        "function": "main",
        "class": "OC\\AppFramework\\App",
        "type": "::",
        "args": [
          "OCA\\Files\\Controller\\ViewController",
          "index",
          {
            " __class__": "OC\\AppFramework\\DependencyInjection\\DIContainer"
          },
          {
            "_route": "files.view.index"
          }
        ]
      },
      {
        "file": "/var/www/html/lib/base.php",
        "line": 1003,
        "function": "match",
        "class": "OC\\Route\\Router",
        "type": "->",
        "args": [
          "/apps/files/"
        ]
      },
      {
        "file": "/var/www/html/index.php",
        "line": 24,
        "function": "handleRequest",
        "class": "OC",
        "type": "::",
        "args": []
      }
    ],
    "File": "/var/www/html/lib/private/AppFramework/Http/Dispatcher.php",
    "Line": 146,
    "Previous": {
      "Exception": "Error",
      "Message": "Object of class OC\\Files\\Node\\File could not be converted to string",
      "Code": 0,
      "Trace": [
        {
          "file": "/var/www/html/lib/private/Files/Template/TemplateManager.php",
          "line": 241,
          "function": "getTemplateFolder",
          "class": "OC\\Files\\Template\\TemplateManager",
          "type": "->",
          "args": []
        },
        {
          "file": "/var/www/html/apps/files/lib/Controller/ViewController.php",
          "line": 196,
          "function": "hasTemplateDirectory",
          "class": "OC\\Files\\Template\\TemplateManager",
          "type": "->",
          "args": []
        },
        {
          "file": "/var/www/html/lib/private/AppFramework/Http/Dispatcher.php",
          "line": 208,
          "function": "index",
          "class": "OCA\\Files\\Controller\\ViewController",
          "type": "->",
          "args": [
            "",
            "",
            null,
            false
          ]
        },
        {
          "file": "/var/www/html/lib/private/AppFramework/Http/Dispatcher.php",
          "line": 114,
          "function": "executeController",
          "class": "OC\\AppFramework\\Http\\Dispatcher",
          "type": "->",
          "args": [
            {
              " __class__": "OCA\\Files\\Controller\\ViewController"
            },
            "index"
          ]
        },
        {
          "file": "/var/www/html/lib/private/AppFramework/App.php",
          "line": 161,
          "function": "dispatch",
          "class": "OC\\AppFramework\\Http\\Dispatcher",
          "type": "->",
          "args": [
            {
              " __class__": "OCA\\Files\\Controller\\ViewController"
            },
            "index"
          ]
        },
        {
          "file": "/var/www/html/lib/private/Route/Router.php",
          "line": 302,
          "function": "main",
          "class": "OC\\AppFramework\\App",
          "type": "::",
          "args": [
            "OCA\\Files\\Controller\\ViewController",
            "index",
            {
              " __class__": "OC\\AppFramework\\DependencyInjection\\DIContainer"
            },
            {
              "_route": "files.view.index"
            }
          ]
        },
        {
          "file": "/var/www/html/lib/base.php",
          "line": 1003,
          "function": "match",
          "class": "OC\\Route\\Router",
          "type": "->",
          "args": [
            "/apps/files/"
          ]
        },
        {
          "file": "/var/www/html/index.php",
          "line": 24,
          "function": "handleRequest",
          "class": "OC",
          "type": "::",
          "args": []
        }
      ],
      "File": "/var/www/html/lib/private/Files/Template/TemplateManager.php",
      "Line": 182
    },
    "message": "Object of class OC\\Files\\Node\\File could not be converted to string in file '/var/www/html/lib/private/Files/Template/TemplateManager.php' line 182",
    "exception": {},
    "CustomMessage": "Object of class OC\\Files\\Node\\File could not be converted to string in file '/var/www/html/lib/private/Files/Template/TemplateManager.php' line 182"
  }
}

```

---

<div class="post-metadata">

**Author:** ![ernolf](https://help.nextcloud.com/user_avatar/help.nextcloud.com/ernolf/32/77874_2.png) [@ernolf](https://help.nextcloud.com/u/ernolf)\
**Post date:** [January 23, 2025, 9:00am UTC](https://help.nextcloud.com/t/internal-server-error-cant-accesses-files/215691/4 "2025-01-23T09:00:03Z")

</div>

Hi @peglegtv,

as you mentioned, it is the same error:

> [@peglegtv](#):
>
> ```auto
> "message": "Object of class OC\\Files\\Node\\File could not be converted to string in file '/var/www/html/lib/private/Files/Template/TemplateManager.php' line 182",
> 
> ```

Since the error only occurs with that one account, I can only imagine either an error in your file structure, or a broken or incorrectly named file, i.e. with unusual characters or encoding.

Did you already run this command:

```sh
docker exec --user www-data CONTAINER_ID php occ files:repair-tree --dry-run

```

and did you already run files:scan with --verbose? Sometimes that gives valuable clues:

```sh
docker exec --user www-data CONTAINER_ID php occ files:scan --verbose -- peglegtv

```

But as you can see, I’m also groping in the dark. 🤔

* * *

Much and good luck,  
ernolf

---

<div class="post-metadata">

**Author:** ![peglegtv](https://help.nextcloud.com/letter_avatar/peglegtv/32/5_5575768a8748004e209b776fc1b2916d.png) [@peglegtv](https://help.nextcloud.com/u/peglegtv)\
**Post date:** [January 23, 2025, 4:28pm UTC](https://help.nextcloud.com/t/internal-server-error-cant-accesses-files/215691/5 "2025-01-23T16:28:41Z")

</div>

Thanks for the reply, I ran those two commands

1st command

```auto
docker exec --user www-data Nextcloud php occ files:repair-tree --dry-run

```

output:

```auto
Found 0 file entries with an invalid path

```

2nd command

```auto
docker exec --user www-data Nextcloud php occ files:scan --verbose -- peglegtv

```

output

```auto
+---------+-------+-----+---------+---------+--------+--------------+
| Folders | Files | New | Updated | Removed | Errors | Elapsed time |
+---------+-------+-----+---------+---------+--------+--------------+
| 1101 | 6859 | 0 | 0 | 0 | 0 | 00:00:07 |
+---------+-------+-----+---------+---------+--------+--------------+

```

still seeing the same error, your not the only one in the dark on this, I’m a windows guy so I’m definitely in the dark

---

<div class="post-metadata">

**Author:** ![jtr](https://help.nextcloud.com/letter_avatar/jtr/32/5_5575768a8748004e209b776fc1b2916d.png) [@jtr](https://help.nextcloud.com/u/jtr)\
**Post date:** [January 23, 2025, 6:28pm UTC](https://help.nextcloud.com/t/internal-server-error-cant-accesses-files/215691/6 "2025-01-23T18:28:09Z")

</div>

Looks like a regression we accidentally introduced in v30.0.5 and immediately fixed.

> <https://github.com/nextcloud/server/issues/50269>
>
> \### ⚠️ This issue respects the following points: ⚠️
> 
> \- \[x\] This is a \*\*bug\*\*, no…t a question or a configuration/webserver/proxy issue.
> \- \[x\] This issue is \*\*not\*\* already reported on \[Github\](https://github.com/nextcloud/server/issues?q=is%3Aopen+is%3Aissue+label%3Abug) OR \[Nextcloud Community Forum\](https://help.nextcloud.com/) \_(I've searched it)\_.
> \- \[x\] Nextcloud Server \*\*is\*\* up to date. See \[Maintenance and Release Schedule\](https://github.com/nextcloud/server/wiki/Maintenance-and-Release-Schedule) for supported versions.
> \- \[x\] I agree to follow Nextcloud's \[Code of Conduct\](https://nextcloud.com/contribute/code-of-conduct/).
> 
> \### Bug description
> 
> The user account does \*\*not\*\* have a \`templates\` folder in its data directory.
> 
> \---
> 
> After updating to \*\*Nextcloud 30.0.5\*\*, the Files app stopped working and displayed an \*\*"Internal Server Error"\*\* when trying to access files.
> 
> The following exception appeared in the logs:
> 
> \`\`\`plaintext
> Object of class OC\\Files\\Node\\File could not be converted to string in file '/var/www/html/lib/private/Files/Template/TemplateManager.php' line 182
> \`\`\`
> 
> \#### Relevant Code:
> The issue originates in the \`getTemplateFolder()\` method in \`/lib/private/Files/Template/TemplateManager.php\`. The problematic line is:
> 
> \`\`\`php
> $this-\>logger-\>warning('Template folder ' . $path . ' not found or invalid', \['app' =\> 'files\_templates'\]);
> \`\`\`
> 
> \#### Cause:
> The variable \`$path\` is not a string but an object of type \`OC\\Files\\Node\\File\`. PHP cannot directly convert such objects to strings unless a \`\_\_toString()\` method is defined, which triggers the exception.
> 
> \### Workaround:
> Commenting out the problematic logging line resolved the issue temporarily:
> \`\`\`php
> //$this-\>logger-\>warning('Template folder ' . $path . ' not found or invalid', \['app' =\> 'files\_templates'\]);
> \`\`\`
> 
> \### Steps to reproduce
> 
> 1. Update Nextcloud to 30.0.5.
> 2. Ensure that the user account does \*\*not\*\* have a \`templates\` folder in its data directory (e.g., \`/data/\<username\>/templates\`).
> 3. Access the Files app through the web interface.
> 4. An "Internal Server Error" page is displayed.
> 
> 
> \### Expected behavior
> 
> The Files app should function without error, even if the template path is invalid or missing.
> 
> \### Nextcloud Server version
> 
> 30
> 
> \### Operating system
> 
> Debian/Ubuntu
> 
> \### PHP engine version
> 
> PHP 8.2
> 
> \### Web server
> 
> Nginx
> 
> \### Database engine version
> 
> MySQL
> 
> \### Is this bug present after an update or on a fresh install?
> 
> Fresh Nextcloud Server install
> 
> \### Are you using the Nextcloud Server Encryption module?
> 
> Encryption is Disabled
> 
> \### What user-backends are you using?
> 
> \- \[x\] Default user-backend \_(database)\_
> \- \[\] LDAP/ Active Directory
> \- \[\] SSO - SAML
> \- \[\] Other
> 
> \### Configuration report
> 
> \`\`\`json
> 
> \`\`\`
> 
> \### List of activated Apps
> 
> \`\`\`shell
> 
> \`\`\`
> 
> \### Nextcloud Signing status
> 
> \`\`\`shell
> 
> \`\`\`
> 
> \### Nextcloud Logs
> 
> \`\`\`json
> 
> \`\`\`
> 
> \### Additional info
> 
> \_No response\_

You can manually apply the tiny adjustment from [here](https://github.com/nextcloud/server/pull/50271/files) if you don’t want to wait for 30.0.6.

---

<div class="post-metadata">

**Author:** ![ren0x](https://help.nextcloud.com/letter_avatar/ren0x/32/5_5575768a8748004e209b776fc1b2916d.png) [@ren0x](https://help.nextcloud.com/u/ren0x)\
**Post date:** [January 23, 2025, 7:25pm UTC](https://help.nextcloud.com/t/internal-server-error-cant-accesses-files/215691/7 "2025-01-23T19:25:13Z")

</div>

Hi, I’m facing the same issue (exact same error messages).  
I’ve also tried the above-mentioned steps, unfortunately, without success. Fortunately, I am still able to sync my files, I’m not sure whether you are able to do so, too.  
The only issue is displaying them in the browser web view 😕

---

<div class="post-metadata">

**Author:** ![peglegtv](https://help.nextcloud.com/letter_avatar/peglegtv/32/5_5575768a8748004e209b776fc1b2916d.png) [@peglegtv](https://help.nextcloud.com/u/peglegtv)\
**Post date:** [January 23, 2025, 8:07pm UTC](https://help.nextcloud.com/t/internal-server-error-cant-accesses-files/215691/8 "2025-01-23T20:07:42Z")

</div>

@jtr Thanks for the information, Ill have to look into it tomorrow when I have a little more time.

@ren0x my files are syncing too, just can’t view them in the browser. so it sounds like the bug @jtr shared

---

<div class="post-metadata">

**Author:** ![ren0x](https://help.nextcloud.com/letter_avatar/ren0x/32/5_5575768a8748004e209b776fc1b2916d.png) [@ren0x](https://help.nextcloud.com/u/ren0x)\
**Post date:** [January 24, 2025, 8:24am UTC](https://help.nextcloud.com/t/internal-server-error-cant-accesses-files/215691/9 "2025-01-24T08:24:36Z")

</div>

Thanks, this works as expected. I deleted the mentioned line in `lib/private/Files/Template/TemplateManager.php` in the docker container itself (I’m just waiting for the new version), and restarted nginx in the docker container.  
I hope I don’t have to recreate it until the update 😉  
Issue resolved.

---

<div class="post-metadata">

**Author:** ![system](https://help.nextcloud.com/user_avatar/help.nextcloud.com/system/32/29333_2.png) [@system](https://help.nextcloud.com/u/system)\
**Post date:** [April 24, 2025, 8:25am UTC](https://help.nextcloud.com/t/internal-server-error-cant-accesses-files/215691/10 "2025-04-24T08:25:04Z")

</div>

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