chenhg5/cc-connect · error

discord: send channel buttons: %w

Error message

discord: send channel buttons: %w

What it means

For a plain replyContext, SendWithButtons posts the content plus component rows via ChannelMessageSendComplex; this error wraps that request's failure. It means Discord rejected or failed the button message send, not that buttons were missing. The wrapped error carries the Discord API code and message.

Source

Thrown at platform/discord/discord.go:1206

	case *interactionReplyCtx:
		if err := p.sendInteraction(rc, content); err != nil {
			return err
		}
		_, err := p.session.FollowupMessageCreate(rc.interaction, true, &discordgo.WebhookParams{
			Content:    content,
			Components: components,
		})
		if err != nil {
			return fmt.Errorf("discord: send button followup: %w", err)
		}
		return nil
	case replyContext:
		_, err := p.session.ChannelMessageSendComplex(rc.targetChannelID(), &discordgo.MessageSend{
			Content:    content,
			Components: components,
		})
		if err != nil {
			return fmt.Errorf("discord: send channel buttons: %w", err)
		}
		return nil
	default:
		return core.ErrNotSupported
	}
}

func (p *progressPlatform) ProgressUpdateInterval() time.Duration {
	return 2 * time.Second
}

var _ core.ImageSender = (*Platform)(nil)
var _ core.FileSender = (*Platform)(nil)
var _ core.InlineButtonSender = (*Platform)(nil)
var _ core.ProgressStyleProvider = (*progressPlatform)(nil)
var _ core.ProgressCardPayloadSupport = (*progressPlatform)(nil)
var _ core.ProgressUpdateThrottler = (*progressPlatform)(nil)

View on GitHub (pinned to 4000b2338a)

Solutions

  1. Read the wrapped Discord error code (50001/50013 = access/permission, 10003 = unknown channel) and fix accordingly
  2. Restore bot messaging permissions in the target channel
  3. Verify the channel/thread ID still exists and the thread is not archived or locked
  4. Retry with backoff on 5xx/rate-limit (429) responses

Example fix

// before: no retry
_, err := p.session.ChannelMessageSendComplex(chID, msg)
// after
_, err := p.session.ChannelMessageSendComplex(chID, msg)
if isRateLimited(err) { time.Sleep(backoff); retry() }
Defensive patterns

Strategy: retry

Validate before calling

perms, err := p.session.ChannelPermissions(channelID, botUserID)
if err != nil || perms&discordgo.PermissionSendMessages == 0 {
    return errors.New("bot cannot send messages in target channel")
}

Try / catch

err := p.SendWithButtons(ctx, rctx, content, buttons)
if isRetryable(err) { // 429 or 5xx
    time.Sleep(backoff)
    err = p.SendWithButtons(ctx, rctx, content, buttons)
}
return err

Prevention

When it happens

Trigger: ChannelMessageSendComplex fails when sending components — missing SEND_MESSAGES/VIEW_CHANNEL permission, invalid component payload, non-existent channel ID, or API/network failure.

Common situations: Bot permissions changed in the channel; channel deleted or thread archived; stale channel ID reconstructed from an old session key; Discord API incident.

Understand the failure class

Background: "API request failed": what wrapped HTTP errors from external APIs mean and how to find the real cause — this error's family across 29 libraries.

Related errors


AI-assisted analysis of chenhg5/cc-connect@4000b2338a (2026-09-06). Data as JSON: /api/errors/f6c9026acfcf62ab. Report an issue: GitHub.