MCP OAuth consent fails with SQLITE_CONSTRAINT: NOT NULL constraint failed: oauth_user_consents.scope
Bug Description
When approving an external MCP client's OAuth access request (the "Claude wants access to your n8n instance" consent screen at /oauth/consent), clicking "Allow" fails with a database error instead of completing the consent. The error is shown both as a toast notification and inline on the consent page.
Error message
SQLITE_CONSTRAINT: NOT NULL constraint failed: oauth_user_consents.scope
Also seen in the browser as: Failed to process consent (repeated in server logs).
To Reproduce
Enable MCP Access (Settings → MCP Access → Enable MCP) From an external MCP client (in my case, Claude), initiate a connection to the n8n instance Browser opens https:///oauth/consent showing the requested permissions (list workflows, get workflow details, execute workflows) Click "Allow" Error appears: "Error allowing access" / SQLITE_CONSTRAINT: NOT NULL constraint failed: oauth_user_consents.scope
Expected behavior The consent should be recorded and the OAuth flow should complete, returning the client to the calling application with a valid access token.
Environment
n8n version: 1.123.80 Database: SQLite (default, no DB_TYPE override) Deployment: self-hosted via official Docker image (n8nio/n8n:1.123.80), behind nginx-proxy-manager reverse proxy Reproduced consistently across multiple attempts, including after fully recreating the container from a freshly pulled image (same digest) and after a clean re-authorization attempt — not a transient/cache issue.
Additional context This appears to happen because the OAuth consent handler doesn't populate a scope value before inserting the row into oauth_user_consents, and that column is NOT NULL. This blocks any external MCP client (e.g. Claude) from completing an OAuth-based connection to this n8n instance's MCP server entirely. Note: this looks related to #30501, but the failure mode is different — I get a NOT NULL constraint on the scope column on the very first consent attempt (not a UNIQUE constraint on retry), and it's reproducing on an older version (1.123.80).
To Reproduce
- Go to Settings → MCP Access, enable "Enable MCP"
- From an external MCP client (e.g. Claude), initiate a connection to this n8n instance for the first time
- Browser opens the consent screen at /oauth/consent showing the requested permissions
- Click "Allow"
- See error: "Error allowing access" / SQLITE_CONSTRAINT: NOT NULL constraint failed: oauth_user_consents.scope
Expected behavior
Clicking "Allow" should record the consent and complete the OAuth flow, returning a valid access token to the calling MCP client, without any database error.
Debug Info
Debug info
core
- n8nVersion: 1.123.80
- platform: docker (self-hosted)
- nodeJsVersion: 24.13.1
- nodeEnv: production
- database: sqlite
- executionMode: regular
- concurrency: -1
- license: enterprise (production)
- consumerId: 7a77f1db-177b-4ef8-bdf2-17950908d940
storage
- success: all
- error: all
- progress: false
- manual: true
- binaryMode: memory
pruning
- enabled: true
- maxAge: 336 hours
- maxCount: 10000 executions
client
- userAgent: mozilla/5.0 (windows nt 10.0; win64; x64) applewebkit/537.36 (khtml, like gecko) chrome/152.0.0.0 safari/537.36
- isTouchDevice: false
Generated at: 2026-09-17T13:39:49.971Z
Operating System
Debian (Docker: n8nio/n8n:1.123.80)
n8n Version
1.123.80
Node.js Version
24.13.1
Database
SQLite (default)
Execution mode
main (default)
Hosting
n8n cloud
Source: n8n-io/n8n