paperclipai/paperclip · error · Error
Discord Application ID does not match the supplied bot token
Error message
Discord Application ID does not match the supplied bot token
What it means
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.
Source
Thrown at server/src/services/chat-discord.ts:233
),
discordJson<DiscordApplication>(
input.fetch,
input.botToken,
"/oauth2/applications/@me",
"application lookup",
),
discordJson<DiscordGuild>(
input.fetch,
input.botToken,
`/guilds/${encodeURIComponent(guildId)}`,
"server membership lookup",
),
]);
if (!user.bot || !user.id || !user.username) {
throw new Error("Discord token does not identify a bot user");
}
if (application.id !== applicationId || user.id !== applicationId) {
throw new Error(
"Discord Application ID does not match the supplied bot token",
);
}
if (((application.flags ?? 0) & MESSAGE_CONTENT_FLAGS) === 0) {
throw new Error(
"Discord Message Content intent is not enabled for this application",
);
}
if (guild.id !== guildId) {
throw new Error("Discord bot is not installed in the selected server");
}
return {
providerAccountId: guildId,
providerAccountLabel: guild.name ?? guildId,
botExternalId: user.id,
botUsername: user.username,
botLabel: user.global_name ?? application.name ?? user.username,
...(user.avatarView on GitHub (pinned to 01ad858492)
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
Example fix
// before DISCORD_APPLICATION_ID=1111111111111111111 // from app A DISCORD_BOT_TOKEN=<token from app B> // after DISCORD_APPLICATION_ID=2222222222222222222 // same app as token DISCORD_BOT_TOKEN=<token from app B>
Defensive patterns
Strategy: validation
Validate before calling
const app = await fetch("https://discord.com/api/v10/oauth2/applications/@me", {
headers: { authorization: `Bot ${botToken}` },
}).then((r) => r.json());
if (app.id !== applicationId) throw new Error("Application ID does not belong to this bot token"); Try / catch
try {
await verifyDiscordBot(input);
} catch (err) {
if (err.message.includes("Application ID does not match")) {
throw new ConfigError("applicationId and botToken must come from the same Discord application");
}
throw err;
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.
Related errors
- Discord token does not identify a bot user
- ${options.errorLabel} decision predicate failed: ${detail}
- ${options.errorLabel} decision predicate exited 0 (expected
- PAPERCLIP_BRIDGE_TOKEN is required.
- No auth user has a non-empty credential account, instance-ad
AI-assisted analysis of paperclipai/paperclip@01ad858492 (2026-09-10).
Data as JSON: /api/errors/73215f51c076997c.
Report an issue: GitHub.