Skip to content

[Bug]: PostgreSQL duplicate key value violates unique constraint "oc_filecache_extended_pkey" #61597

Description

@dietmarhein

⚠️ This issue respects the following points: ⚠️

Bug description

2026-06-24 06:48:09.658 CEST [336893] ERROR:  duplicate key value violates unique constraint "oc_filecache_extended_pkey"
2026-06-24 06:48:09.658 CEST [336893] DETAIL:  Key (fileid)=(1044313) already exists.
2026-06-24 06:48:09.658 CEST [336893] STATEMENT:  INSERT INTO "oc_filecache_extended" ("fileid", "creation_time") VALUES($1, $2)
2026-06-24 06:48:09.774 CEST [336893] ERROR:  duplicate key value violates unique constraint "oc_filecache_extended_pkey"
2026-06-24 06:48:09.774 CEST [336893] DETAIL:  Key (fileid)=(1044312) already exists.
2026-06-24 06:48:09.774 CEST [336893] STATEMENT:  INSERT INTO "oc_filecache_extended" ("fileid", "creation_time") VALUES($1, $2)
2026-06-24 07:48:10.357 CEST [356981] ERROR:  duplicate key value violates unique constraint "oc_filecache_extended_pkey"
2026-06-24 07:48:10.357 CEST [356981] DETAIL:  Key (fileid)=(1044313) already exists.
2026-06-24 07:48:10.357 CEST [356981] STATEMENT:  INSERT INTO "oc_filecache_extended" ("fileid", "creation_time") VALUES($1, $2)
2026-06-24 07:48:10.456 CEST [356981] ERROR:  duplicate key value violates unique constraint "oc_filecache_extended_pkey"
2026-06-24 07:48:10.456 CEST [356981] DETAIL:  Key (fileid)=(1044312) already exists.
2026-06-24 07:48:10.456 CEST [356981] STATEMENT:  INSERT INTO "oc_filecache_extended" ("fileid", "creation_time") VALUES($1, $2)

Issue is causing high iostat to SSD and RAM usage from PostgreSQL.
Host is nearly not usable any more due to heavy load.

What has been done so far:

cleanup DB - delete from table or truncate table oc_filecache_extended
check and adopted mount settings for btrfs; chattr +C for databasefile
disabled and uninstalled Memories App
disabled and uninstalled Group Folders App
Other information
Host OS
Debian 12 bookworm: 6.1.174-1 (2026-05-26) x86_64 GNU/Linux
Nextcloud AIO: NC 33.0.5
PostgreSQL 18.4

Docker info

Client: Docker Engine - Community
 Version:    29.6.0
 Context:    default
 Debug Mode: false
 Plugins:
  buildx: Docker Buildx (Docker Inc.)
    Version:  v0.34.1
    Path:     /usr/libexec/docker/cli-plugins/docker-buildx
  compose: Docker Compose (Docker Inc.)
    Version:  v5.1.4
    Path:     /usr/libexec/docker/cli-plugins/docker-compose

Server:
 Containers: 13
  Running: 12
  Paused: 0
  Stopped: 1
 Images: 13
 Server Version: 29.6.0
 Storage Driver: overlay2
  Backing Filesystem: btrfs
  Supports d_type: true
  Using metacopy: false
  Native Overlay Diff: true
  userxattr: false
 Logging Driver: json-file
 Cgroup Driver: systemd
 Cgroup Version: 2
 Plugins:
  Volume: local
  Network: bridge host ipvlan macvlan null overlay
  Log: awslogs fluentd gcplogs gelf journald json-file local splunk syslog
 CDI spec directories:
  /etc/cdi
  /var/run/cdi
 Swarm: inactive
 Runtimes: runc io.containerd.runc.v2
 Default Runtime: runc
 Init Binary: docker-init
 containerd version: e53c7c1516c3b2bff98eb76f1f4117477e6f4e66
 runc version: v1.3.6-0-g491b69ba
 init version: de40ad0
 Security Options:
  apparmor
  seccomp
   Profile: builtin
  cgroupns
 Kernel Version: 6.1.0-49-amd64
 Operating System: Debian GNU/Linux 12 (bookworm)
 OSType: linux
 Architecture: x86_64
 CPUs: 4
 Total Memory: 15.37GiB
 Name: morpheus
 ID: d7c93caa-e386-48f0-88c1-c9879f0afbee
 Docker Root Dir: /data/docker
 Debug Mode: false
 Experimental: false
 Insecure Registries:
  ::1/128
  127.0.0.0/8
 Live Restore Enabled: false
 Firewall Backend: iptables
  EnableUserlandProxy: true
  UserlandProxyPath: /usr/bin/docker-proxy

Steps to reproduce

  1. Start Nextcloud AIO
  2. Wait, no interaction at, no file upload or download, ...
  3. Have a look to database logs; iostat; RAM usage; postgres process

Expected behavior

no key value violations

Nextcloud Server version

33

Operating system

Debian/Ubuntu

PHP engine version

PHP 8.3

Web server

Apache (supported)

Database engine version

PostgreSQL

Is this bug present after an update or on a fresh install?

None

Are you using the Nextcloud Server Encryption module?

Encryption is Disabled

What user-backends are you using?

  • Default user-backend (database)
  • LDAP/ Active Directory
  • SSO - SAML
  • Other

Configuration report

{
    "system": {
        "one-click-instance": true,
        "one-click-instance.user-limit": 100,
        "memcache.local": "\\OC\\Memcache\\APCu",
        "apps_paths": [
            {
                "path": "\/var\/www\/html\/apps",
                "url": "\/apps",
                "writable": false
            },
            {
                "path": "\/var\/www\/html\/custom_apps",
                "url": "\/custom_apps",
                "writable": true
            }
        ],
        "appsallowlist": false,
        "check_data_directory_permissions": false,
        "memcache.distributed": "\\OC\\Memcache\\Redis",
        "memcache.locking": "\\OC\\Memcache\\Redis",
        "redis": {
            "host": "***REMOVED SENSITIVE VALUE***",
            "password": "***REMOVED SENSITIVE VALUE***",
            "port": 6379,
            "timeout": 3,
            "read_timeout": 10
        },
        "overwritehost": "cloud.vierviertel.org",
        "overwriteprotocol": "https",
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "localhost",
            "cloud.vierviertel.org"
        ],
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "dbtype": "pgsql",
        "version": "33.0.5.1",
        "overwrite.cli.url": "https:\/\/cloud.vierviertel.org\/",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbport": "",
        "dbtableprefix": "oc_",
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "installed": true,
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "maintenance": false,
        "maintenance_window_start": 100,
        "updatedirectory": "\/nc-updater",
        "loglevel": 2,
        "log_type": "file",
        "logfile": "\/var\/www\/html\/data\/nextcloud.log",
        "log_rotate_size": "104857600",
        "log.condition": {
            "apps": [
                "admin_audit"
            ]
        },
        "preview_max_x": 1024,
        "preview_max_y": 1024,
        "jpeg_quality": 60,
        "enabledPreviewProviders": {
            "0": "OC\\Preview\\Imaginary",
            "1": "OC\\Preview\\TXT",
            "2": "OC\\Preview\\OpenDocument",
            "3": "OC\\Preview\\Movie",
            "4": "OC\\Preview\\Krita",
            "5": "OC\\Preview\\ImaginaryPDF",
            "6": "OC\\Preview\\HEIC",
            "7": "OC\\Preview\\TIFF",
            "8": "OC\\Preview\\ImaginaryPDF",
            "9": "OC\\Preview\\Image",
            "10": "OC\\Preview\\ImaginaryPDF",
            "23": "OC\\Preview\\ImaginaryPDF"
        },
        "enable_previews": true,
        "upgrade.disable-web": true,
        "mail_smtpmode": "smtp",
        "trashbin_retention_obligation": "auto, 7",
        "versions_retention_obligation": "auto, 30",
        "activity_expire_days": "30",
        "simpleSignUpLink.shown": false,
        "share_folder": "\/Shared",
        "one-click-instance.link": "https:\/\/nextcloud.com\/all-in-one\/",
        "upgrade.cli-upgrade-link": "https:\/\/github.com\/nextcloud\/all-in-one\/discussions\/2726",
        "allow_local_remote_servers": true,
        "davstorage.request_timeout": 3600,
        "htaccess.RewriteBase": "\/",
        "dbpersistent": false,
        "files_external_allow_create_new_local": false,
        "trusted_proxies": "***REMOVED SENSITIVE VALUE***",
        "preview_imaginary_url": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpsecure": "ssl",
        "mail_sendmailmode": "smtp",
        "mail_from_address": "***REMOVED SENSITIVE VALUE***",
        "mail_domain": "***REMOVED SENSITIVE VALUE***",
        "mail_smtphost": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpauth": 1,
        "mail_smtpport": "465",
        "mail_smtpname": "***REMOVED SENSITIVE VALUE***",
        "mail_smtppassword": "***REMOVED SENSITIVE VALUE***",
        "twofactor_enforced": "true",
        "twofactor_enforced_groups": [
            "home"
        ],
        "twofactor_enforced_excluded_groups": [],
        "default_locale": "de_AT",
        "default_phone_region": "AT",
        "preview_imaginary_key": "***REMOVED SENSITIVE VALUE***",
        "auth.bruteforce.protection.enabled": true,
        "ratelimit.protection.enabled": true,
        "documentation_url.server_logs": "https:\/\/github.com\/nextcloud\/all-in-one\/discussions\/5425",
        "memories.db.triggers.fcu": true,
        "memories.exiftool": "\/var\/www\/html\/custom_apps\/memories\/bin-ext\/exiftool-amd64-musl",
        "memories.vod.path": "\/var\/www\/html\/custom_apps\/memories\/bin-ext\/go-vod-amd64",
        "memories.vod.ffmpeg": "\/usr\/bin\/ffmpeg",
        "memories.vod.ffprobe": "\/usr\/bin\/ffprobe",
        "memories.gis_type": 2,
        "updatechecker": false,
        "serverid": 445,
        "log_type_audit": "file",
        "logfile_audit": "\/var\/www\/html\/data\/audit.log",
        "app_install_overwrite": [],
        "backgroundjobs": "OC\\BackgroundJob\\Cron",
        "update_channel": "stable",
        "memories.cache_dir": "\/mnt\/ncdata\/memories_cache",
        "DOMAIN": "cloud.vierviertel.org",
        "AIO_VERSION": "v13.2.1"
    }
}

List of activated Apps

Enabled:
  - activity: 6.0.0
  - admin_audit: 1.23.0
  - app_api: 33.0.0
  - bruteforcesettings: 6.0.0
  - calendar: 6.5.0
  - circles: 33.0.0
  - cloud_federation_api: 1.17.0
  - comments: 1.23.0
  - contacts: 8.7.1
  - dashboard: 7.13.0
  - dav: 1.36.0
  - federatedfilesharing: 1.23.0
  - federation: 1.23.0
  - files: 2.5.0
  - files_antivirus: 6.3.0
  - files_downloadlimit: 5.1.0
  - files_pdfviewer: 6.0.0
  - files_reminders: 1.6.0
  - files_sharing: 1.25.2
  - files_trashbin: 1.23.0
  - files_versions: 1.26.0
  - firstrunwizard: 6.0.0
  - integration_google: 4.4.0
  - logreader: 6.0.0
  - lookup_server_connector: 1.21.0
  - metavox: 2.2.0
  - nextcloud-aio: 0.8.0
  - nextcloud_announcements: 5.0.0
  - notes: 6.0.0
  - notifications: 6.0.0
  - notify_push: 1.3.3
  - oauth2: 1.21.0
  - password_policy: 5.0.0
  - photos: 6.0.0
  - previewgenerator: 5.13.0
  - privacy: 5.0.0
  - profile: 1.2.0
  - provisioning_api: 1.23.0
  - recommendations: 6.0.0
  - related_resources: 4.0.0
  - richdocuments: 10.2.0
  - serverinfo: 5.0.0
  - settings: 1.16.0
  - sharebymail: 1.23.0
  - support: 5.0.0
  - survey_client: 5.0.0
  - suspicious_login: 11.0.0
  - systemtags: 1.23.0
  - tasks: 0.17.1
  - text: 7.0.1
  - theming: 2.8.0
  - twofactor_backupcodes: 1.22.0
  - twofactor_totp: 15.0.0
  - updatenotification: 1.23.0
  - user_status: 1.13.0
  - viewer: 6.0.0
  - weather_status: 1.13.0
  - webhook_listeners: 1.5.0
  - workflowengine: 2.15.0
Disabled:
  - contactsinteraction: 1.14.1 (installed 1.9.0)
  - encryption: 2.21.0 (installed 2.16.0)
  - files_external: 1.25.1
  - twofactor_nextcloud_notification: 7.0.0
  - user_ldap: 1.24.0

Nextcloud Signing status

No errors have been found.

Nextcloud Logs

Warnung no app in context Capabilities of OCA\Theming\Capabilities took 0.46 seconds to generate. 25.06.2026,17:38:54

Warnung no app in context Capabilities of OCA\Theming\Capabilities took 0.47 seconds to generate. 
25.06.2026, 17:38:47

Additional info

It is a Nextcloud AIO installation; I opened a ticket for AIO but I was asked to open a ticket here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    0. Needs triagePending check for reproducibility or if it fits our roadmap33-feedbackbug

    Type

    No fields configured for Bug.

    Projects

    Status
    To triage

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions