{"record":{"id":"73215f51c076997c","repo":"paperclipai/paperclip","slug":"discord-application-id-does-not-match-the-supplied","errorCode":null,"errorMessage":"Discord Application ID does not match the supplied bot token","messagePattern":"Discord Application ID does not match the supplied bot token","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"server/src/services/chat-discord.ts","lineNumber":233,"sourceCode":"    ),\n    discordJson<DiscordApplication>(\n      input.fetch,\n      input.botToken,\n      \"/oauth2/applications/@me\",\n      \"application lookup\",\n    ),\n    discordJson<DiscordGuild>(\n      input.fetch,\n      input.botToken,\n      `/guilds/${encodeURIComponent(guildId)}`,\n      \"server membership lookup\",\n    ),\n  ]);\n  if (!user.bot || !user.id || !user.username) {\n    throw new Error(\"Discord token does not identify a bot user\");\n  }\n  if (application.id !== applicationId || user.id !== applicationId) {\n    throw new Error(\n      \"Discord Application ID does not match the supplied bot token\",\n    );\n  }\n  if (((application.flags ?? 0) & MESSAGE_CONTENT_FLAGS) === 0) {\n    throw new Error(\n      \"Discord Message Content intent is not enabled for this application\",\n    );\n  }\n  if (guild.id !== guildId) {\n    throw new Error(\"Discord bot is not installed in the selected server\");\n  }\n  return {\n    providerAccountId: guildId,\n    providerAccountLabel: guild.name ?? guildId,\n    botExternalId: user.id,\n    botUsername: user.username,\n    botLabel: user.global_name ?? application.name ?? user.username,\n    ...(user.avatar","sourceCodeStart":215,"sourceCodeEnd":251,"githubUrl":"https://github.com/paperclipai/paperclip/blob/01ad8584922b5d85292b1723cae71fa0d9b07a19/server/src/services/chat-discord.ts#L215-L251","documentation":"After identity checks, verifyDiscordBot requires that both the fetched application id and the bot user id equal the caller-provided Application ID. This error means the token authenticates successfully but belongs to a different Discord application than the one configured — a mismatch between the bot token and application ID credentials.","triggerScenarios":"Application ID env var from app A paired with bot token from app B; rotating the bot in the Developer Portal and updating the token but not the Application ID (or vice versa); pasting a guild/user ID into the applicationId field.","commonSituations":"Multiple Discord apps in config (staging/prod) with swapped values; re-creating an application so the old configured ID no longer matches any live token; team members copying values from different apps.","solutions":["Open the Discord Developer Portal, copy the Application ID from the same application whose Bot page supplied the token, and update config so both come from one app","Call GET /oauth2/applications/@me with the token and use its returned id as the Application ID","Search config/env for other Discord app values that may have been mixed in"],"exampleFix":"// before\nDISCORD_APPLICATION_ID=1111111111111111111  // from app A\nDISCORD_BOT_TOKEN=<token from app B>\n// after\nDISCORD_APPLICATION_ID=2222222222222222222  // same app as token\nDISCORD_BOT_TOKEN=<token from app B>","handlingStrategy":"validation","validationCode":"const app = await fetch(\"https://discord.com/api/v10/oauth2/applications/@me\", {\n  headers: { authorization: `Bot ${botToken}` },\n}).then((r) => r.json());\nif (app.id !== applicationId) throw new Error(\"Application ID does not belong to this bot token\");","typeGuard":null,"tryCatchPattern":"try {\n  await verifyDiscordBot(input);\n} catch (err) {\n  if (err.message.includes(\"Application ID does not match\")) {\n    throw new ConfigError(\"applicationId and botToken must come from the same Discord application\");\n  }\n  throw err;\n}","preventionTips":["Copy Application ID and bot token from the same application page in one session","Label staging/prod Discord credentials distinctly to avoid swaps","Add a startup check that pairs token and application ID via /oauth2/applications/@me"],"tags":["discord","auth","config-mismatch"],"backgroundTag":"invalid-config-value","analyzedSha":"01ad8584922b5d85292b1723cae71fa0d9b07a19","analyzedAt":"2026-09-10T03:14:50.855Z","contentChangedAt":"2026-09-10T03:14:50.855Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}