chenhg5/cc-connect · error
qqbot: app_id is required
Error message
qqbot: app_id is required
What it means
The qqbot platform constructor New() requires an "app_id" string in its options map and fails fast at startup if it is missing or empty. This is configuration validation before any network activity, so a bad config is caught immediately when the platform is created.
Source
Thrown at platform/qqbot/qqbot.go:152
ReferencedMessage *quotedMessage `json:"referenced_message,omitempty"`
SourceMessage *quotedMessage `json:"source_message,omitempty"`
}
// msgTypeQuote indicates a quote (reply) message in the QQ Bot API.
const msgTypeQuote = 103
// msgElement represents a message element in QQ Bot event.
// For quote messages (message_type=103), msg_elements[0] contains the quoted content.
type msgElement struct {
Content string `json:"content"`
Attachments []attachment `json:"attachments"`
}
// New creates a new QQ Bot platform from config options.
func New(opts map[string]any) (core.Platform, error) {
appID, _ := opts["app_id"].(string)
if appID == "" {
return nil, fmt.Errorf("qqbot: app_id is required")
}
appSecret, _ := opts["app_secret"].(string)
if appSecret == "" {
return nil, fmt.Errorf("qqbot: app_secret is required")
}
sandbox, _ := opts["sandbox"].(bool)
allowFrom, _ := opts["allow_from"].(string)
shareSessionInChannel, _ := opts["share_session_in_channel"].(bool)
markdownSupport, _ := opts["markdown_support"].(bool)
intents := defaultIntents
if v, ok := opts["intents"].(int); ok && v > 0 {
intents = v
} else if v, ok := opts["intents"].(float64); ok && v > 0 {
intents = int(v)
}
View on GitHub (pinned to 4000b2338a)
Solutions
- Add app_id = "<your QQ bot app id>" to the qqbot platform section of config.toml (get it from the QQ Open Platform bot settings).
- Verify the key is inside the correct TOML table ([platforms.qqbot]) and spelled app_id, not appId or appid.
- Ensure the value is a quoted string, not a number — a bare integer fails the string type assertion.
- Confirm the environment that generates your config (templates, envsubst) actually emits the app_id field.
Example fix
// before
p, err := qqbot.New(map[string]any{"app_secret": "s3cret"}) // missing app_id
// after
p, err := qqbot.New(map[string]any{"app_id": "123456", "app_secret": "s3cret"}) Defensive patterns
Strategy: validation
Validate before calling
appID, _ := opts["app_id"].(string)
if appID == "" {
return errors.New("qqbot: app_id must be a non-empty string before calling New")
} Type guard
func validOpts(opts map[string]any) bool {
id, ok := opts["app_id"].(string)
return ok && id != ""
} Try / catch
p, err := qqbot.New(opts)
if err != nil {
return fmt.Errorf("loading qqbot platform: %w", err) // fails fast at startup
} Prevention
- Keep app_id and app_secret together in the [platforms.qqbot] TOML table.
- Quote the app id as a string even if it is numeric.
- Run cc-connect with a config linter / doctor check before deploying.
- If generating config from env vars, assert required keys are non-empty at render time.
When it happens
Trigger: Calling qqbot.New(opts) (directly or via config loading at cc-connect startup) when opts has no "app_id" key, has app_id set to "", or app_id is of a non-string type (the type assertion yields "" for non-strings).
Common situations: TOML config missing the app_id field under [platforms.qqbot] (or placed under the wrong section). App ID quoted incorrectly or left empty. Loading config from an env-based renderer that dropped the key. Running tests that intentionally omit credentials.
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
- PreflightRunAsUser: RunAsUser is empty
- googlechat: subscription is required (the Pub/Sub subscripti
- googlechat: credentials_file is required (the Chat app's ser
- qqbot: app_secret is required
- qqbot: failed to get access token: %w
AI-assisted analysis of chenhg5/cc-connect@4000b2338a (2026-09-06).
Data as JSON: /api/errors/0b5428665514bcaf.
Report an issue: GitHub.