sipeed/picoclaw · error
dingtalk client_id and client_secret are required
Error message
dingtalk client_id and client_secret are required
What it means
NewDingTalkChannel fails fast when either ClientID or ClientSecret in DingTalkSettings is empty. It is a construction-time config validation fired before any SDK client is built, so the channel is never registered when credentials are missing.
Source
Thrown at pkg/channels/dingtalk/dingtalk.go:45
*channels.BaseChannel
config *config.DingTalkSettings
clientID string
clientSecret string
streamClient *client.StreamClient
ctx context.Context
cancel context.CancelFunc
// Map to store session webhooks for each chat
sessionWebhooks sync.Map // chatID -> sessionWebhook
}
// NewDingTalkChannel creates a new DingTalk channel instance
func NewDingTalkChannel(
bc *config.Channel,
cfg *config.DingTalkSettings,
messageBus *bus.MessageBus,
) (*DingTalkChannel, error) {
if cfg.ClientID == "" || cfg.ClientSecret.String() == "" {
return nil, fmt.Errorf("dingtalk client_id and client_secret are required")
}
// Set the logger for the Stream SDK
dinglog.SetLogger(logger.NewLogger("dingtalk"))
base := channels.NewBaseChannel("dingtalk", cfg, messageBus, bc.AllowFrom,
channels.WithMaxMessageLength(20000),
channels.WithGroupTrigger(bc.GroupTrigger),
channels.WithReasoningChannelID(bc.ReasoningChannelID),
)
return &DingTalkChannel{
BaseChannel: base,
config: cfg,
clientID: cfg.ClientID,
clientSecret: cfg.ClientSecret.String(),
}, nil
}View on GitHub (pinned to 49183d7e8d)
Solutions
- Set both dingtalk.client_id and dingtalk.client_secret in the config (create a robot on DingTalk Open Platform and copy its AppKey/AppSecret)
- If the secret comes from an environment variable, verify it is set in the service environment (docker env, systemd EnvironmentFile) and restart
- Check YAML indentation and exact key names against the config reference
Example fix
# before
channels:
dingtalk:
enabled: true
# after
channels:
dingtalk:
enabled: true
client_id: "ding0nxxxxxxx"
client_secret: "your-app-secret" Defensive patterns
Strategy: validation
Validate before calling
func validateDingTalkConfig(cfg *config.DingTalkSettings) error {
if cfg.ClientID == "" || cfg.ClientSecret.String() == "" {
return fmt.Errorf("dingtalk client_id and client_secret are required")
}
return nil
} Prevention
- Validate dingtalk credentials at config load time, before channel construction
- If secrets come from env vars, add a startup check that they resolve non-empty
- Use a config linter/schema validation so missing keys fail fast with clear messages
When it happens
Trigger: Constructing the dingtalk channel with a config block that omits client_id/client_secret, has empty strings, or references an env var for the secret that is unset at process start.
Common situations: First-time setup using a config template without filling values, typoed YAML keys, secret sourced from an env var missing in docker-compose/systemd units, deploying with a different environment than local dev.
Related errors
- feishu app_id or app_secret is empty
- credential: file:// reference has no filename
- ${label} must be a JSON object.
- ${label}.${key} must be a string.
- Enter and confirm the new login password.
AI-assisted analysis of sipeed/picoclaw@49183d7e8d (2026-08-15).
Data as JSON: /api/errors/b4ff339858dd2e48.
Report an issue: GitHub.