Internal server error, Can't accesses files

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:

formatted log entry:

[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:

{
  "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

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

no errors found

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

no errors found

I’m at a loss, please help

Hi @peglegtv,

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

So please post the output of

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

ernolf

@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

{
  "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"
  }
}

Hi @peglegtv,

as you mentioned, it is the same error:

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:

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:

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. :thinking:


Much and good luck,
ernolf

Thanks for the reply, I ran those two commands

1st command

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

output:

Found 0 file entries with an invalid path

2nd command

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

output

+---------+-------+-----+---------+---------+--------+--------------+
| 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

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

You can manually apply the tiny adjustment from here if you don’t want to wait for 30.0.6.

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 :confused:

@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

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 :wink:
Issue resolved.