nextcloud / nextcloud/server

[Bug]: FilesMetadataException - json cannot exceed 100000 characters long

Open
#42,308 22 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

0. Needs triage 28-feedback bug feature: filesystem feature: previews and thumbnails
Dominant language
PHP
Stars
36.9k
Forks
5.2k
Avg merge
2d 3h
Merged PRs (30d)
713

Description

⚠️ This issue respects the following points: ⚠️
Bug description

Saw this exception in the log:

{
    "reqId": "LKZ6NZIAZIqyK75Gy13j",
    "level": 3,
    "time": "2023-12-14T23:50:46+01:00",
    "remoteAddr": "",
    "user": "--",
    "app": "core",
    "method": "",
    "url": "--",
    "message": "{\"Exception\":\"OCP\\\\FilesMetadata\\\\Exceptions\\\\FilesMetadataException\",\"Message\":\"json cannot exceed 100000 characters long\",\"Code\":0,\"Trace\":[{\"file\":\"/var/www/nextcloud/lib/private/FilesMetadata/FilesMetadataManager.php\",\"line\":116,\"function\":\"saveMetadata\",\"class\":\"OC\\\\FilesMetadata\\\\FilesMetadataManager\",\"type\":\"->\"},{\"file\":\"/var/www/nextcloud/core/BackgroundJobs/GenerateMetadataJob.php\",\"line\":105,\"function\":\"refreshMetadata\",\"class\":\"OC\\\\FilesMetadata\\\\FilesMetadataManager\",\"type\":\"->\"},{\"file\":\"/var/www/nextcloud/core/BackgroundJobs/GenerateMetadataJob.php\",\"line\":101,\"function\":\"scanFolder\",\"class\":\"OC\\\\Core\\\\BackgroundJobs\\\\GenerateMetadataJob\",\"type\":\"->\"},{\"file\":\"/var/www/nextcloud/core/BackgroundJobs/GenerateMetadataJob.php\",\"line\":101,\"function\":\"scanFolder\",\"class\":\"OC\\\\Core\\\\BackgroundJobs\\\\GenerateMetadataJob\",\"type\":\"->\"},{\"file\":\"/var/www/nextcloud/core/BackgroundJobs/GenerateMetadataJob.php\",\"line\":90,\"function\":\"scanFolder\",\"class\":\"OC\\\\Core\\\\BackgroundJobs\\\\GenerateMetadataJob\",\"type\":\"->\"},{\"file\":\"/var/www/nextcloud/core/BackgroundJobs/GenerateMetadataJob.php\",\"line\":81,\"function\":\"scanFilesForUser\",\"class\":\"OC\\\\Core\\\\BackgroundJobs\\\\GenerateMetadataJob\",\"type\":\"->\"},{\"file\":\"/var/www/nextcloud/lib/public/BackgroundJob/Job.php\",\"line\":81,\"function\":\"run\",\"class\":\"OC\\\\Core\\\\BackgroundJobs\\\\GenerateMetadataJob\",\"type\":\"->\"},{\"file\":\"/var/www/nextcloud/lib/public/BackgroundJob/TimedJob.php\",\"line\":102,\"function\":\"start\",\"class\":\"OCP\\\\BackgroundJob\\\\Job\",\"type\":\"->\"},{\"file\":\"/var/www/nextcloud/lib/public/BackgroundJob/TimedJob.php\",\"line\":92,\"function\":\"start\",\"class\":\"OCP\\\\BackgroundJob\\\\TimedJob\",\"type\":\"->\"},{\"file\":\"/var/www/nextcloud/cron.php\",\"line\":152,\"function\":\"execute\",\"class\":\"OCP\\\\BackgroundJob\\\\TimedJob\",\"type\":\"->\"}],\"File\":\"/var/www/nextcloud/lib/private/FilesMetadata/FilesMetadataManager.php\",\"Line\":179,\"message\":\"Error while running background job (class: OC\\\\Core\\\\BackgroundJobs\\\\GenerateMetadataJob, arguments: )\",\"exception\":{},\"CustomMessage\":\"Error while running background job (class: OC\\\\Core\\\\BackgroundJobs\\\\GenerateMetadataJob, arguments: )\"}",
    "userAgent": "--",
    "version": "28.0.0.11"
}
Steps to reproduce

No idea, happened in the background job.

Expected behavior

Should not fail.

Installation method

Community Manual installation with Archive

Nextcloud Server version

28

Operating system

Debian/Ubuntu

PHP engine version

PHP 8.2

Web server

Apache (supported)

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

No response

List of activated Apps

No response

Nextcloud Signing status

No response

Nextcloud Logs

No response

Additional info

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading lib/private/FilesMetadata/FilesMetadataManager.php, especially saveMetadata, then trace how core/BackgroundJobs/GenerateMetadataJob.php reaches it. The report provides no reproduction steps, so investigate the background-job path and the 100000-character exception. Done should mean the metadata job no longer fails for the reported condition, with coverage for the resulting behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.