chenhg5/cc-connect · error

dingtalk: card_template_id not configured

Error message

dingtalk: card_template_id not configured

What it means

CreateStreamingCard refuses to create a streaming (AI) card when cardTemplateID is empty, i.e. no card_template_id was provided in the DingTalk platform config. Streaming cards in DingTalk must be created from a pre-published card template in the DingTalk open platform.

Source

Thrown at platform/dingtalk/dingtalk.go:1086

	if resp.StatusCode != http.StatusOK {
		return fmt.Errorf("dingtalk: send image failed: status=%d, body=%s", resp.StatusCode, string(respBody))
	}

	slog.Info("dingtalk: image message sent", "media_id", mediaID, "user", rc.senderStaffId)
	return nil
}

var _ core.ImageSender = (*Platform)(nil)
var _ core.StreamingCardPlatform = (*Platform)(nil)
var _ core.ReplyContextReconstructor = (*Platform)(nil)
var _ core.TypingIndicator = (*Platform)(nil)
var _ core.TypingIndicatorDone = (*Platform)(nil)

// CreateStreamingCard creates a new streaming card for the given reply context.
// Implements core.StreamingCardPlatform.
func (p *Platform) CreateStreamingCard(ctx context.Context, replyCtx any) (core.StreamingCard, error) {
	if p.cardTemplateID == "" {
		return nil, fmt.Errorf("dingtalk: card_template_id not configured")
	}
	if p.isCardDegraded() {
		return nil, fmt.Errorf("dingtalk: card API temporarily degraded")
	}
	rc, ok := replyCtx.(replyContext)
	if !ok {
		return nil, fmt.Errorf("dingtalk: invalid reply context type %T", replyCtx)
	}
	return p.createAICard(ctx, rc)
}

// SendFile uploads and sends a file via DingTalk oToMessages API.
// Implements core.FileSender.
func (p *Platform) SendFile(ctx context.Context, rctx any, file core.FileAttachment) error {
	rc, ok := rctx.(replyContext)
	if !ok {
		return fmt.Errorf("dingtalk: SendFile: invalid reply context type %T", rctx)
	}

View on GitHub (pinned to 4000b2338a)

Solutions

  1. Create an AI card template in DingTalk open platform and copy its templateID
  2. Set card_template_id in the dingtalk platform config section
  3. Restart cc-connect after editing config.toml
  4. If you don't want streaming cards, disable the streaming-card feature instead

Example fix

// before
[[platforms]]
name = "dingtalk"

// after
[[platforms]]
name = "dingtalk"
card_template_id = "your-template-id-from-dingtalk"
Defensive patterns

Strategy: validation

Validate before calling

// at startup, after config load
if cfg.CardTemplateID == "" && cfg.StreamCardsEnabled {
    log.Fatal("dingtalk: card_template_id is required when streaming cards are enabled")
}

Prevention

When it happens

Trigger: Engine requests a streaming card (StreamCard enabled) but config.toml's [platforms.dingtalk] lacks card_template_id.

Common situations: User enables streaming card output without registering a template in DingTalk's card platform and copying its template ID into config; typo'd config key so it defaults to empty.

Understand the failure class

Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.

Related errors


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