sipeed/picoclaw · error

download media: %w

Error message

download media: %w

What it means

Error "download media: %w" thrown in sipeed/picoclaw.

Source

Thrown at pkg/channels/wecom/media.go:290

	return filename, contentType
}

func (c *WeComChannel) storeRemoteMedia(
	ctx context.Context,
	scope, msgID, resourceURL, aesKey, fallbackExt string,
) (string, error) {
	store := c.GetMediaStore()
	if store == nil {
		return "", fmt.Errorf("no media store available")
	}

	req, err := http.NewRequestWithContext(ctx, http.MethodGet, resourceURL, nil)
	if err != nil {
		return "", fmt.Errorf("create request: %w", err)
	}
	resp, err := c.mediaClient.Do(req)
	if err != nil {
		return "", fmt.Errorf("download media: %w", err)
	}
	defer resp.Body.Close()
	if resp.StatusCode != http.StatusOK {
		return "", fmt.Errorf("download media returned HTTP %d", resp.StatusCode)
	}

	data, err := io.ReadAll(io.LimitReader(resp.Body, wecomOutboundMediaMaxBytes+1))
	if err != nil {
		return "", fmt.Errorf("read media: %w", err)
	}
	if len(data) > wecomOutboundMediaMaxBytes {
		return "", fmt.Errorf("media too large")
	}

	if aesKey != "" {
		key, keyErr := decodeMediaAESKey(aesKey)
		if keyErr != nil {
			return "", keyErr

View on GitHub (pinned to 49183d7e8d)

When it happens

Trigger: Thrown at pkg/channels/wecom/media.go:290 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of sipeed/picoclaw@49183d7e8d (2026-08-15). Data as JSON: /api/errors/e46183f6fa651cbd. Report an issue: GitHub.