ERR_ERL_UNEXPECTED_X_FORWARDED_FOR and Could not find the data table

Dear Support Team,
We have created a new n8n container and we are encountering an error during operation.
Kindly find the n8n log file attached for your reference.
Please review the issue and assist us in identifying and resolving the error at the earliest.
Thank you for your support.

Describe the problem/error/question

We have created a new n8n container and we are encountering an error during operation.

What is the error message (if any)?

SQLITE_ERROR: duplicate column name: ID
User attempted to access a workflow without permissions
Could not find the data table: ‘m857ZsP8va53GDaQ’
Could not find the data table: ‘m857ZsP8va53GDaQ’
Could not find the data table: ‘m857ZsP8va53GDaQ’
ValidationError: The ‘X-Forwarded-For’ header is set but the Express ‘trust proxy’ setting is false (default). This could indicate a misconfiguration which would prevent express-rate-limit from accurately identifying users. See Page Redirection for more information.
at Object.xForwardedForHeader (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/[email protected][email protected]/node_modules/express-rate-limit/dist/index.cjs:187:13)
at Object.wrappedValidations. [as xForwardedForHeader] (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/[email protected][email protected]/node_modules/express-rate-limit/dist/index.cjs:398:22)
at Object.keyGenerator (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/[email protected][email protected]/node_modules/express-rate-limit/dist/index.cjs:671:20)
at /usr/local/lib/node_modules/n8n/node_modules/.pnpm/[email protected][email protected]/node_modules/express-rate-limit/dist/index.cjs:724:32
at /usr/local/lib/node_modules/n8n/node_modules/.pnpm/[email protected][email protected]/node_modules/express-rate-limit/dist/index.cjs:704:5 {
code: ‘ERR_ERL_UNEXPECTED_X_FORWARDED_FOR’,
help: ‘https://express-rate-limit.github.io/ERR_ERL_UNEXPECTED_X_FORWARDED_FOR/’
}
User attempted to access a workflow without permissions
User attempted to access a workflow without permissions
Could not find the data table: ‘m857ZsP8va53GDaQ’
Could not find the data table: ‘m857ZsP8va53GDaQ’

Please share your workflow

(Select the nodes on your canvas and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the workflow.)

Share the output returned by the last node

Information on your n8n setup

  • **n8n version:**2.2.6
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main): default
  • Running n8n via (Docker, npm, n8n cloud, desktop app):Docker
  • Operating system: Oracle Linux Server 9.0

You’re experiencing two separate issues that need to be addressed:

**For the X-Forwarded-For error:** Add the environment variable `N8N_PROXY_HOPS=1` to your Docker container configuration. This tells n8n to trust the proxy headers from your reverse proxy setup. As mentioned in [funable.medium.com](https://funable.medium.com/fixing-n8n-docker-error-the-x-forwarded-for-issue-bonus-d6924694b09a) and [blog.camel.dev](https://blog.camel.dev/posts/express-trust-proxy-x-forwarded-for-error), this resolves the Express trust proxy validation error.

**For the database issues:** The “SQLITE_ERROR: duplicate column name: ID” suggests a database migration problem, and the “Could not find the data table” errors indicate corrupted or missing data. You may need to restore from a backup or reinitialize your n8n database if this is a fresh installation.

Make sure to restart your container after adding the `N8N_PROXY_HOPS=1` environment variable using `docker-compose down && docker-compose up -d`.