chenhg5/cc-connect · error

%s: %s retry cancelled: %w (last error: %v)

Error message

%s: %s retry cancelled: %w (last error: %v)

What it means

withTransientRetry: the context was cancelled while sleeping between retry attempts; the cancellation error is wrapped together with the last transient error so callers can see both. Expected during shutdown or operation timeouts.

Source

Thrown at platform/feishu/feishu.go:4227

		if !isTransientError(lastErr) {
			return lastErr
		}
		if attempt == maxTransientRetries {
			break
		}
		// Add jitter: up to +25% of delay to spread out concurrent retries.
		jitter := time.Duration(rand.Int64N(int64(delay / 4)))
		actualDelay := delay + jitter
		slog.Warn(p.tag()+": transient error, retrying",
			"operation", operation,
			"attempt", attempt+1,
			"max_retries", maxTransientRetries,
			"delay", actualDelay,
			"error", lastErr,
		)
		select {
		case <-ctx.Done():
			return fmt.Errorf("%s: %s retry cancelled: %w (last error: %v)", p.tag(), operation, ctx.Err(), lastErr)
		case <-time.After(actualDelay):
		}
		delay = min(delay*2, transientRetryMaxDelay)
	}
	return fmt.Errorf("%s failed after %d retries: %w", operation, maxTransientRetries, lastErr)
}

// ── Issue #1618: fail-closed + supervised retry for bot open_id ──
//
// When the Feishu/Lark bot-info API call fails at startup (transient
// proxy/VPN/DNS outage, server hiccup, etc.), the bot's open_id stays
// unknown. The previous behaviour read this as "group mention filter
// off", so the bot would reply to every group message for the rest of
// the process lifetime — a 3h10m window in the user's incident where
// the bot suddenly became a loud responder with no way for operators
// to notice. The functions below:
//
//   - wrap the initial fetch in transient retry so most startup

View on GitHub (pinned to 4000b2338a)

Solutions

  1. Normal during shutdown — no action needed
  2. If frequent, increase the operation timeout or lower the retry delay
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at platform/feishu/feishu.go:4227 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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