Updating n8n without data loss: version pinning, backup, rollback
How to update n8n safely: version pinning, backup of database and encryption key, the right approach.
n8n can be updated without data loss if you create a complete backup of the database and the encryption key before every update, deliberately pin the target version instead of automatically updating to "latest", and test the new version in a test environment first. The official n8n documentation recommends updating regularly, at least once a month, and not skipping several major versions, because otherwise the risk of a disruptive update increases. Workflows that appear to be missing after an update are in practice almost never actual data loss, but a configuration error with Docker volumes or user permissions. As of: July 2026.
Why shouldn't you simply update n8n to the latest version?
An uncontrolled update to the latest version is the most common cause of unpleasant surprises. n8n itself recommends in the official update documentation to update regularly so you don't have to skip several versions at once, to check the release notes for breaking changes before every update, and to run the new version in a separate test environment first before it goes into production. Anyone who instead skips updates for months and then jumps several major versions at once increases the risk that outdated nodes, changed data structures, or removed functions strike simultaneously. Details on the recommended approach can be found in the n8n update documentation.
How do you pin the n8n version with Docker and npm?
Version pinning means using a specific version number instead of a moving tag such as "latest", so that a restart or redeploy doesn't unintentionally pull a newer version. With Docker, you pull a fixed image tag, for example with docker pull docker.n8n.io/n8nio/n8n followed by the desired version number as the tag, and enter the same number in your compose file, as described in the Docker installation guide. For an npm installation, you install a specific version with npm install -g n8n followed by the version number, according to the npm installation guide. According to the documentation, you should explicitly not use the next tag for beta versions in production. Only once the pinned new version runs cleanly in the test environment should you update the production instance to the same number.
What do you need to back up before the update?
Before every update, two things belong in the backup: the database with all workflows and executions, and the encryption key. n8n encrypts stored credentials with a key that is either automatically stored in the .n8n directory on first start, or set via the N8N_ENCRYPTION_KEY environment variable, as described in the encryption key documentation. If this key is lost, for example because a Docker container is rebuilt without a persisted volume, stored credentials can no longer be decrypted, even if the database itself is intact. In queue mode, according to the documentation, every worker must also receive the same encryption key, otherwise the main and worker processes encrypt and decrypt with different keys. Anyone who additionally uses encryption key rotation should, according to the key rotation documentation, first create a complete database backup, because activation is, according to n8n, a one way step with no rollback path.
What should you do if workflows are missing after an update?
Missing workflows after an update are as a rule not actual data loss, but an access problem. In n8n community forums, users repeatedly report seemingly vanished workflows after an update, where the cause usually turns out to be an incorrectly mounted Docker volume or incorrect user permissions in the container: the database still exists, the n8n process just can no longer find or read it after the restart. So first check whether your data directory is correctly mounted as a volume and whether the container runs with the same user as before the update. With a current database backup, the state before the update can be restored in an emergency, which is effectively your rollback, since n8n does not offer a built in one click rollback to an older version. Anyone who does not want to secure this process themselves can outsource it as part of n8n consulting and support to NordFlux.
Frequently asked questions about n8n updates
How often should I update n8n?
n8n recommends in the official documentation updating at least once a month. This prevents several major versions from piling up, causing a single update to bring several breaking changes at once. Smaller, more frequent updates are easier to test and easier to narrow down in case of errors.
Is a database backup alone enough to protect against data loss?
No, without the matching encryption key a database backup is worthless for stored credentials. n8n encrypts credentials with this key, and without it the encrypted values from the database can no longer be made readable. Always back up the database and encryption key together.
Is there an official rollback mechanism in n8n?
No, n8n does not offer a built in one click rollback to a previous version. The practical rollback path is to reinstall the pinned old image or the old npm version, and restore the previously backed up database along with the encryption key.
What is the difference between the encryption key and encryption key rotation?
The encryption key, set via N8N_ENCRYPTION_KEY, is the one fixed master key with which n8n encrypts credentials. Encryption key rotation is a separate, optional feature for instances that want to periodically exchange the internal data key, where according to the documentation a complete backup is mandatory beforehand, because the activation cannot be undone.
NordFlux UG (haftungsbeschränkt)
NordFlux builds digital employees for organisations: automations and AI agents that take over repetitive work. You stay in control.
Concrete questions about automation or AI?
In a free initial analysis we discuss your case directly. No strings attached.