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
- Create an AI card template in DingTalk open platform and copy its templateID
- Set card_template_id in the dingtalk platform config section
- Restart cc-connect after editing config.toml
- 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
- Validate required config fields at startup, before the engine starts
- Follow the DingTalk docs to create an AI card template and copy its templateID exactly
- Keep a config example/README entry for card_template_id
- Fall back to plain-text streaming when the template is not configured
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
- dingtalk: client_id and client_secret are required
- dingtalk: robot_code is required (or client_id)
- dingtalk: card API temporarily degraded
- cron project not found
- attachment send is disabled by config
AI-assisted analysis of chenhg5/cc-connect@4000b2338a (2026-09-06).
Data as JSON: /api/errors/5a52fb32b73cb9a6.
Report an issue: GitHub.