chenhg5/cc-connect · error

slack: resolve channel name for %s: %w

Error message

slack: resolve channel name for %s: %w

What it means

ResolveChannelName maps a Slack channel ID to its human-readable name via client.GetConversationInfo. This error wraps any failure from that API call — invalid or unknown channel ID, missing scope, rate limit, or network error — and includes the channel ID for context.

Source

Thrown at platform/slack/slack.go:649

	if err != nil || name == "" {
		return channelID
	}
	return name
}

func (p *Platform) ResolveChannelName(channelID string) (string, error) {
	p.channelCacheMu.RLock()
	if name, ok := p.channelNameCache[channelID]; ok {
		p.channelCacheMu.RUnlock()
		return name, nil
	}
	p.channelCacheMu.RUnlock()

	info, err := p.client.GetConversationInfo(&slack.GetConversationInfoInput{
		ChannelID: channelID,
	})
	if err != nil {
		return "", fmt.Errorf("slack: resolve channel name for %s: %w", channelID, err)
	}

	p.channelCacheMu.Lock()
	p.channelNameCache[channelID] = info.Name
	p.channelCacheMu.Unlock()

	return info.Name, nil
}

// FormattingInstructions returns Slack mrkdwn formatting guidance for the agent.
func (p *Platform) FormattingInstructions() string {
	return `You are responding in Slack. Use Slack's mrkdwn format, NOT standard Markdown:
- Bold: *text* (single asterisks, not double)
- Italic: _text_
- Strikethrough: ~text~
- Code: ` + "`text`" + `
- Code block: ` + "```text```" + `
- Blockquote: > text

View on GitHub (pinned to 4000b2338a)

Solutions

  1. Verify the channel ID exists and the bot can see it (try conversations.list with the same token)
  2. Add the required scope (channels:read for public, groups:read for private) and reinstall the app
  3. Check whether the error wraps a rate-limit (rate_limited) and retry with backoff
  4. Invite the bot to the channel or use a channel ID from a fresh session

Example fix

// before
// token lacks channels:read, GetConversationInfo fails
// after
// In Slack app settings: OAuth & Permissions -> add channels:read / groups:read, reinstall app
Defensive patterns

Strategy: try-catch

Validate before calling

// pre-flight: can this token resolve channels at all?
_, err := p.client.GetConversations(&slack.GetConversationsParameters{Limit: 1})

Try / catch

name, err := p.ResolveChannelName(channelID)
var rl *slack.RateLimitedError
if errors.As(err, &rl) { time.Sleep(rl.RetryAfter); name, err = p.ResolveChannelName(channelID) }
if err != nil { name = channelID /* fallback to raw ID */ }

Prevention

When it happens

Trigger: GetConversationInfo returns an error: channel ID no longer exists (channel deleted/archived), bot is not a member and lacks the scope, Slack rate limit hit, or network/API failure.

Common situations: Bot token missing groups:read/channels:read scope; messaging a channel the bot was removed from; stale channel ID stored in an old session after the channel was deleted; Slack 429 rate limiting under heavy traffic.

Related errors


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