Skip to content

Content provider "analytics" fails with "Entity which should be updated has no id" #250

Description

@kyteinsky

Which version of Nextcloud are you using?

v34.0.0

Which version of PHP context_chat are you using?

5.4.0

Which version of backend context_chat are you using?

5.4.0

Which browser are you using? In case you are using the phone App, specify the Android or iOS version and device please.

Nextcloud deployment method?

bare-metal

Describe the Bug

insertOrUpdate fails for content items provided by the Analytics app. They are present in the DB (PHP side DB containing all the content providers' items) since the update path is chosen but the DB complains the id field is missing.

To Reproduce

PHP logs (Warning these might contain sensitive information)

No response

Ex-App logs (Warning these might contain sensitive information)

No response

Server logs (if applicable)

{
  "reqId": "9sesqawf3aO02VqAi39v",
  "level": 3,
  "time": "2026-06-26T08:45:33+00:00",
  "remoteAddr": "...",
  "user": "...",
  "app": "index",
  "method": "POST",
  "url": "/apps/analytics/dataload/execute",
  "scriptName": "/index.php",
  "message": "Entity which should be updated has no id",
  "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.5 Safari/605.1.15",
  "version": "34.0.1.2",
  "exception": {
    "Exception": "InvalidArgumentException",
    "Message": "Entity which should be updated has no id",
    "Code": 0,
    "Trace": [
      {
        "file": "/var/www/html/lib/public/AppFramework/Db/QBMapper.php",
        "line": 151,
        "function": "update",
        "class": "OCP\\AppFramework\\Db\\QBMapper",
        "type": "->",
        "args": [
          "*** sensitive parameters replaced ***"
        ]
      },
      {
        "file": "/var/www/html/apps/context_chat/lib/Public/ContentManager.php",
        "line": 140,
        "function": "insertOrUpdate",
        "class": "OCP\\AppFramework\\Db\\QBMapper",
        "type": "->"
      },
      {
        "file": "/var/www/html/apps/analytics/lib/ContextChat/ContextChatManager.php",
        "line": 80,
        "function": "submitContent",
        "class": "OCA\\ContextChat\\Public\\ContentManager",
        "type": "->"
      },
      {
        "file": "/var/www/html/apps/analytics/lib/Service/DatasetService.php",
        "line": 269,
        "function": "submitContent",
        "class": "OCA\\Analytics\\ContextChat\\ContextChatManager",
        "type": "->"
      },
      {
        "file": "/var/www/html/apps/analytics/lib/Service/DataloadService.php",
        "line": 291,
        "function": "provider",
        "class": "OCA\\Analytics\\Service\\DatasetService",
        "type": "->"
      },
      {
        "file": "/var/www/html/apps/analytics/lib/Controller/DataloadController.php",
        "line": 129,
        "function": "execute",
        "class": "OCA\\Analytics\\Service\\DataloadService",
        "type": "->"
      },
      {
        "file": "/var/www/html/lib/private/AppFramework/Http/Dispatcher.php",
        "line": 165,
        "function": "execute",
        "class": "OCA\\Analytics\\Controller\\DataloadController",
        "type": "->"
      },
      {
        "file": "/var/www/html/lib/private/AppFramework/Http/Dispatcher.php",
        "line": 78,
        "function": "executeController",
        "class": "OC\\AppFramework\\Http\\Dispatcher",
        "type": "->"
      },
      {
        "file": "/var/www/html/lib/private/AppFramework/App.php",
        "line": 137,
        "function": "dispatch",
        "class": "OC\\AppFramework\\Http\\Dispatcher",
        "type": "->"
      },
      {
        "file": "/var/www/html/lib/private/Route/Router.php",
        "line": 324,
        "function": "main",
        "class": "OC\\AppFramework\\App",
        "type": "::"
      },
      {
        "file": "/var/www/html/lib/base.php",
        "line": 1159,
        "function": "match",
        "class": "OC\\Route\\Router",
        "type": "->"
      },
      {
        "file": "/var/www/html/index.php",
        "line": 25,
        "function": "handleRequest",
        "class": "OC",
        "type": "::"
      }
    ],
    "File": "/var/www/html/lib/public/AppFramework/Db/QBMapper.php",
    "Line": 178,
    "message": "Entity which should be updated has no id",
    "exception": "{\"class\":\"InvalidArgumentException\",\"message\":\"Entity which should be updated has no id\",\"code\":0,\"file\":\"/var/www/html/lib/public/AppFramework/Db/QBMapper.php:178\",\"trace\":\"#0 /var/www/html/lib/public/AppFramework/Db/QBMapper.php(151): OCP\\AppFramework\\Db\\QBMapper->update()\\n#1 /var/www/html/apps/context_chat/lib/Public/ContentManager.php(140): OCP\\AppFramework\\Db\\QBMapper->insertOrUpdate()\\n#2 /var/www/html/apps/analytics/lib/ContextChat/ContextChatManager.php(80): OCA\\ContextChat\\Public\\ContentManager->submitContent()\\n#3 /var/www/html/apps/analytics/lib/Service/DatasetService.php(269): OCA\\Analytics\\ContextChat\\ContextChatManager->submitContent()\\n#4 /var/www/html/apps/analytics/lib/Service/DataloadService.php(291): OCA\\Analytics\\Service\\DatasetService->provider()\\n#5 /var/www/html/apps/analytics/lib/Controller/DataloadController.php(129): OCA\\Analytics\\Service\\DataloadService->execute()\\n#6 /var/www/html/lib/private/AppFramework/Http/Dispatcher.php(165): OCA\\Analytics\\Controller\\DataloadController->execute()\\n#7 /var/www/html/lib/private/AppFramework/Http/Dispatcher.php(78): OC\\AppFramework\\Http\\Dispatcher->executeController()\\n#8 /var/www/html/lib/private/AppFramework/App.php(137): OC\\AppFramework\\Http\\Dispatcher->dispatch()\\n#9 /var/www/html/lib/private/Route/Router.php(324): OC\\AppFramework\\App::main()\\n#10 /var/www/html/lib/base.php(1159): OC\\Route\\Router->match()\\n#11 /var/www/html/index.php(25): OC::handleRequest()\\n#12 {main}\"}",
    "CustomMessage": "Entity which should be updated has no id"
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions