Skip to content

Global commands can't recover once their cached ID goes stale (process_application_commands) #3359

Description

@LordRhino

Summary

Hit this on a bot with only global commands (no debug_guilds/guild_ids anywhere). Every now and then, a command vanishes from the Discord client's command picker - "Unknown Integration" - only a full restart brings it back.

Reproduction Steps

  1. Register any slash command as global (no debug_guilds/guild_ids set anywhere on the bot or command).
  2. Make it do nothing but defer, asyncio.sleep(30), then reply.
  3. Run it, wait for it to finish.
  4. Immediately run any other slash command.

Works best with plenty of commands as it seemed to only corrupt half my commands

Minimal Reproducible Code

@bot.slash_command(name="slowtest")
async def slowtest(ctx: discord.ApplicationContext):
    await ctx.defer()
    await asyncio.sleep(30)
    await ctx.followup.send("done")

Expected Results

Either command still works

Actual Results

Command disappears from the Discord client's command list. Trying it shows "Unknown Integration" client-side. No exception, no log output, nothing printed on the bot's side at all - the interaction never seems to reach process_application_commands's failure path in any visible way. Only fixed by a full bot restart (which runs an unfiltered sync_commands() via on_ready).

Root cause of the code, once you go looking:

(source)

Intents

Tested with discord.Intents.all() not intent-related as far as I can tell

System Information

- Python v3.11.16-final
- py-cord v2.8.1-final
- aiohttp v3.14.3
- system info: Linux 7.0.0-30-generic #30-Ubuntu SMP PREEMPT_DYNAMIC Fri Jul 31 18:22:54 UTC 2026

Checklist

  • I have searched the open issues for duplicates.
  • I have shown the entire traceback, if possible.
  • I have removed my token from display, if visible.
  • I have read the Contributing Guidelines.

Additional Context

Related to #1561 / PR #1262, which fixed the guild_id string-vs-int comparison in this same function - that fix is present and working. This is a separate gap in the same fallback, specific to global commands, that #1262 didn't cover.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

unconfirmed bugA bug report that needs triaging

Type

Projects

  • Status
    Todo

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions