Skip to content

[master tag] 500 error while doing API request with invalid json #449

@saw-jan

Description

@saw-jan

⚠️ use master image tag

Steps to reproduce:

  1. run Nextcloud:

    docker run --rm -e SERVER_BRANCH=stable33 -e NEXTCLOUD_AUTOINSTALL=true -p 8080:80 ghcr.io/juliusknorr/nextcloud-dev-php83:master
  2. enable integration_openproject app

  3. request with invalid json:

    curl -XPOST 'http://localhost:8080/index.php/apps/integration_openproject/setup' -u admin:admin -d'{"values:}' -H'Content-Type: application/json'
    500 Internal Server Error
    {some html}

I also tried to get the methods execution order using logs and the logs order is wrong:

# decodeContent (order 2)
{
  "reqId": "J7zUbJ4jtrj5meoylBaJ",
  "level": 2,
  "time": "2026-02-06T12:48:59+00:00",
  "remoteAddr": "172.28.0.4",
  "user": "--",
  "app": "no app in context",
  "method": "POST",
  "url": "/index.php/apps/integration_openproject/setup",
  "scriptName": "/index.php",
  "message": "Trace: Array\n(\n    [0] => Array\n        (\n            [file] => /var/www/html/lib/private/AppFramework/Http/Request.php\n            [line] => 370\n            [function] => decodeContent\n            [class] => OC\\AppFramework\\Http\\Request\n            [type] => ->\n        )\n\n    [1] => Array\n        (\n            [file] => /var/www/html/lib/private/AppFramework/Http/Request.php\n            [line] => 229\n            [function] => getContent\n            [class] => OC\\AppFramework\\Http\\Request\n            [type] => ->\n        )\n\n    [2] => Array\n        (\n            [file] => /var/www/html/lib/private/AppFramework/Http/Request.php\n            [line] => 298\n            [function] => __get\n            [class] => OC\\AppFramework\\Http\\Request\n            [type] => ->\n        )\n\n    [3] => Array\n        (\n            [file] => /var/www/html/lib/private/Profiler/BuiltInProfiler.php\n            [line] => 78\n            [function] => getParam\n            [class] => OC\\AppFramework\\Http\\Request\n            [type] => ->\n        )\n\n    [4] => Array\n        (\n            [file] => /var/www/html/lib/private/Profiler/BuiltInProfiler.php\n            [line] => 29\n            [function] => shouldProfileSingleRequest\n            [class] => OC\\Profiler\\BuiltInProfiler\n            [type] => ->\n        )\n\n    [5] => Array\n        (\n            [file] => /var/www/html/lib/base.php\n            [line] => 706\n            [function] => start\n            [class] => OC\\Profiler\\BuiltInProfiler\n            [type] => ->\n        )\n\n    [6] => Array\n        (\n            [file] => /var/www/html/lib/base.php\n            [line] => 1286\n            [function] => init\n            [class] => OC\n            [type] => ::\n        )\n\n    [7] => Array\n        (\n            [file] => /var/www/html/index.php\n            [line] => 23\n            [args] => Array\n                (\n                    [0] => /var/www/html/lib/base.php\n                )\n\n            [function] => require_once\n        )\n\n)\n",
  "userAgent": "curl/7.81.0",
  "version": "33.0.0.14",
  "data": []
}
# throwDecodingExceptionIfAny (order 1)
{
  "reqId": "J7zUbJ4jtrj5meoylBaJ",
  "level": 2,
  "time": "2026-02-06T12:48:59+00:00",
  "remoteAddr": "172.28.0.4",
  "user": "--",
  "app": "no app in context",
  "method": "POST",
  "url": "/index.php/apps/integration_openproject/setup",
  "scriptName": "/index.php",
  "message": "Trace: Array\n(\n    [0] => Array\n        (\n            [file] => /var/www/html/lib/base.php\n            [line] => 1085\n            [function] => throwDecodingExceptionIfAny\n            [class] => OC\\AppFramework\\Http\\Request\n            [type] => ->\n        )\n\n    [1] => Array\n        (\n            [file] => /var/www/html/index.php\n            [line] => 25\n            [function] => handleRequest\n            [class] => OC\n            [type] => ::\n        )\n\n)\n",
  "userAgent": "curl/7.81.0",
  "version": "33.0.0.14",
  "data": []
}

👉 But the same works with local setup and old ghcr.io/juliusknorr/nextcloud-dev-php83:20231202-1 image tag
I get expected 400 error ✔️
For this working scenarios, the logs order is correct

# throwDecodingExceptionIfAny (order 1)
{
  "reqId": "aYXdKbEp9UcrqfyNszaLZAAAAAI",
  "level": 2,
  "time": "2026-02-06T12:23:05+00:00",
  "remoteAddr": "127.0.0.1",
  "user": "--",
  "app": "no app in context",
  "method": "POST",
  "url": "/nextcloud/stable33/index.php/apps/integration_openproject/setup",
  "scriptName": "/nextcloud/stable33/index.php",
  "message": "Trace: Array\n(\n    [0] => Array\n        (\n            [file] => /mnt/workspace/www/nextcloud/stable33/lib/base.php\n            [line] => 1103\n            [function] => throwDecodingExceptionIfAny\n            [class] => OC\\AppFramework\\Http\\Request\n            [type] => ->\n        )\n\n    [1] => Array\n        (\n            [file] => /mnt/workspace/www/nextcloud/stable33/index.php\n            [line] => 25\n            [function] => handleRequest\n            [class] => OC\n            [type] => ::\n        )\n\n)\n",
  "userAgent": "curl/7.81.0",
  "version": "33.0.0.14",
  "data": []
}
# decodeContent (order 2)
{
  "reqId": "aYXdKbEp9UcrqfyNszaLZAAAAAI",
  "level": 2,
  "time": "2026-02-06T12:23:05+00:00",
  "remoteAddr": "127.0.0.1",
  "user": "admin",
  "app": "no app in context",
  "method": "POST",
  "url": "/nextcloud/stable33/index.php/apps/integration_openproject/setup",
  "scriptName": "/nextcloud/stable33/index.php",
  "message": "Trace: Array\n(\n    [0] => Array\n        (\n            [file] => /mnt/workspace/www/nextcloud/stable33/lib/private/AppFramework/Http/Request.php\n            [line] => 370\n            [function] => decodeContent\n            [class] => OC\\AppFramework\\Http\\Request\n            [type] => ->\n        )\n\n    [1] => Array\n        (\n            [file] => /mnt/workspace/www/nextcloud/stable33/lib/private/AppFramework/Http/Request.php\n            [line] => 229\n            [function] => getContent\n            [class] => OC\\AppFramework\\Http\\Request\n            [type] => ->\n        )\n\n    [2] => Array\n        (\n            [file] => /mnt/workspace/www/nextcloud/stable33/lib/private/AppFramework/Http/Request.php\n            [line] => 298\n            [function] => __get\n            [class] => OC\\AppFramework\\Http\\Request\n            [type] => ->\n        )\n\n    [3] => Array\n        (\n            [file] => /mnt/workspace/www/nextcloud/stable33/lib/private/AppFramework/Http/Dispatcher.php\n            [line] => 187\n            [function] => getParam\n            [class] => OC\\AppFramework\\Http\\Request\n            [type] => ->\n        )\n\n    [4] => Array\n        (\n            [file] => /mnt/workspace/www/nextcloud/stable33/lib/private/AppFramework/Http/Dispatcher.php\n            [line] => 118\n            [function] => executeController\n            [class] => OC\\AppFramework\\Http\\Dispatcher\n            [type] => ->\n        )\n\n    [5] => Array\n        (\n            [file] => /mnt/workspace/www/nextcloud/stable33/lib/private/AppFramework/App.php\n            [line] => 153\n            [function] => dispatch\n            [class] => OC\\AppFramework\\Http\\Dispatcher\n            [type] => ->\n        )\n\n    [6] => Array\n        (\n            [file] => /mnt/workspace/www/nextcloud/stable33/lib/private/Route/Router.php\n            [line] => 321\n            [function] => main\n            [class] => OC\\AppFramework\\App\n            [type] => ::\n        )\n\n    [7] => Array\n        (\n            [file] => /mnt/workspace/www/nextcloud/stable33/lib/base.php\n            [line] => 1156\n            [function] => match\n            [class] => OC\\Route\\Router\n            [type] => ->\n        )\n\n    [8] => Array\n        (\n            [file] => /mnt/workspace/www/nextcloud/stable33/index.php\n            [line] => 25\n            [function] => handleRequest\n            [class] => OC\n            [type] => ::\n        )\n\n)\n",
  "userAgent": "curl/7.81.0",
  "version": "33.0.0.14",
  "data": []
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions