Discord API · error code

Discord error 10006: Unknown invite

Permanent - do not retryHTTP 404Unknown resource (10xxx)

Last verified against Discord Developer Docs - Opcodes and status codes

What Discord returns
Unknown invite

What error 10006 means

Discord could not find an invite with the code you passed. The lookup is by the short code (the part after discord.gg/), and it fails the same way whether the code was mistyped, expired, used up, or deleted by a moderator. Discord does not tell you which of those happened; from the API's point of view an expired invite simply no longer exists.

You usually meet 10006 on GET /invites/{invite.code} when a bot resolves a link posted in chat, or on DELETE /invites/{invite.code} when an invite-cleanup task tries to revoke something that has already gone. Invites with a max_age vanish when the timer runs out, and invites with max_uses vanish after the last use, so a code that worked an hour ago can legitimately return 10006 now.

Nothing is wrong with your token or permissions. A missing Manage Server or Manage Channels permission on delete produces 50013, not this code.

What it looks like

{
  "message": "Unknown invite",
  "code": 10006
}

Why it happens

  • The invite reached its max_age and expired
  • The invite hit its max_uses limit and was removed
  • A moderator or another bot revoked the invite before your request
  • The code was parsed incorrectly from a URL (trailing punctuation, query string, or the full discord.gg URL passed instead of the code)
  • The guild the invite pointed to was deleted

How to fix Discord error 10006

  1. 1Log the exact code your bot sent and confirm it contains only the code, not the full URL
  2. 2Strip trailing characters such as ), ., or ? that users often paste after links
  3. 3Treat 10006 on DELETE as success: the invite you wanted gone is already gone
  4. 4When resolving user-posted links, report "invite expired or invalid" instead of throwing
  5. 5If you create invites for users, set max_age and max_uses deliberately and store the returned code

How to stop it recurring

Never cache an invite code as if it were permanent. Re-resolve before showing invite details, and when your bot needs a long-lived link, create one with max_age: 0 and max_uses: 0 and store it. The 1,000-invite cap that hits bots creating invites in a loop is covered on 30016.

Official reference: Discord Developer Docs - Opcodes and status codes. See all Discord error codes or the Discord limits and quotas.

Related codes

Error 10006 - quick answers

What does Discord error 10006 mean?

Discord could not find an invite with the code you passed. The lookup is by the short code (the part after discord.gg/ ), and it fails the same way whether the code was mistyped, expired, used up, or deleted by a moderator. Discord does not tell you which of those happened; from the API's point of view an expired invite simply no longer exists.

How do I fix Discord error 10006?

1. Log the exact code your bot sent and confirm it contains only the code, not the full URL 2. Strip trailing characters such as ), ., or ? that users often paste after links 3. Treat 10006 on DELETE as success: the invite you wanted gone is already gone 4. When resolving user-posted links, report "invite expired or invalid" instead of throwing 5. If you create invites for users, set max_age and max_uses deliberately and store the returned code

Should I retry after error 10006?

No. Retrying the same request produces the same error; the condition has to be fixed first. Treat it as a permanent failure for that message and surface it, rather than looping.

Stop debugging Discord by hand

Connect the channel through Conferbot: tokens, webhooks and retries are handled, failures show as readable status.