chenhg5/cc-connect · error

wecom: send markdown: %w

Error message

wecom: send markdown: %w

What it means

Transport-level failure of POST /cgi-bin/message/send with the markdown payload (used by Reply): the HTTP request itself failed — network unreachable, connection reset, TLS or timeout — before any status or errcode was seen. It is the markdown counterpart of the image send path's transport wrap.

Source

Thrown at platform/wecom/wecom.go:607

var _ core.ImageSender = (*Platform)(nil)

func (p *Platform) sendMarkdown(accessToken, toUser, content string) error {
	payload := map[string]any{
		"touser":   toUser,
		"msgtype":  "markdown",
		"agentid":  p.agentID,
		"markdown": map[string]string{"content": content},
	}

	body, _ := json.Marshal(payload)
	apiURL := p.wecomAPIURL("/cgi-bin/message/send", url.Values{
		"access_token": []string{accessToken},
	})

	resp, err := p.apiClient.Post(apiURL, "application/json", strings.NewReader(string(body)))
	if err != nil {
		return fmt.Errorf("wecom: send markdown: %w", err)
	}
	defer resp.Body.Close()

	var result struct {
		ErrCode int    `json:"errcode"`
		ErrMsg  string `json:"errmsg"`
	}
	if err := json.NewDecoder(resp.Body).Decode(&result); err != nil {
		return fmt.Errorf("wecom: decode send response: %w", err)
	}
	if result.ErrCode != 0 {
		return fmt.Errorf("wecom: send markdown failed: %d %s", result.ErrCode, result.ErrMsg)
	}
	return nil
}

func (p *Platform) sendText(accessToken, toUser, text string) error {
	payload := map[string]any{

View on GitHub (pinned to 4000b2338a)

Solutions

  1. Retry the send with backoff; markdown sends are idempotent from the user's perspective
  2. Verify network/proxy connectivity to qyapi.weixin.qq.com
  3. If it recurs for all sends, check DNS and firewall on the host
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at platform/wecom/wecom.go:607 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/930e00d8fa9ae470. Report an issue: GitHub.