chenhg5/cc-connect · error
tuitui: invalid group_policy %q (want allowlist, open, or di
Error message
tuitui: invalid group_policy %q (want allowlist, open, or disabled)
What it means
The optional group_policy option only accepts "allowlist", "open", or "disabled" (case-insensitive); any other value makes New() fail. This policy controls how the bot treats group chats, so an unknown value is treated as a config error rather than silently defaulting.
Source
Thrown at platform/tuitui/tuitui.go:131
apiBase = defaultAPIBase
}
wsBase, _ := opts["ws_base"].(string)
if wsBase == "" {
wsBase = defaultWSBase
}
allowFrom, _ := opts["allow_from"].(string)
core.CheckAllowFrom("tuitui", allowFrom)
groupAllowFrom, _ := opts["group_allow_from"].(string)
ignoreFrom, _ := opts["ignore_from"].(string)
groupPolicy, _ := opts["group_policy"].(string)
if groupPolicy == "" {
groupPolicy = "allowlist"
}
groupPolicy = strings.ToLower(strings.TrimSpace(groupPolicy))
switch groupPolicy {
case "allowlist", "open", "disabled":
default:
return nil, fmt.Errorf("tuitui: invalid group_policy %q (want allowlist, open, or disabled)", groupPolicy)
}
requireMention := true
if v, ok := opts["require_mention"].(bool); ok {
requireMention = v
}
receiveReaction := "收到"
if v, ok := opts["receive_reaction"].(string); ok {
receiveReaction = strings.TrimSpace(v)
}
shareSessionInChannel, _ := opts["share_session_in_channel"].(bool)
pendingHistoryLimit := defaultHistoryLimit
if v, ok := intOption(opts["history_limit"]); ok {
if v < 0 {
return nil, fmt.Errorf("tuitui: history_limit must be non-negative")
}
pendingHistoryLimit = v
}
View on GitHub (pinned to 4000b2338a)
Solutions
- Change group_policy to exactly one of: allowlist, open, or disabled.
- Remember matching is lowercase after trim — "Allowlist" works but "allow list" does not.
- Remove the group_policy key entirely to use the default (allowlist).
- Check config.example.toml for documented accepted values.
Example fix
// before group_policy = "whitelist" // after group_policy = "allowlist"
Defensive patterns
Strategy: validation
Validate before calling
var validPolicies = map[string]bool{"allowlist": true, "open": true, "disabled": true}
policy := strings.ToLower(strings.TrimSpace(cfg["group_policy"]))
if policy != "" && !validPolicies[policy] {
return fmt.Errorf("group_policy must be allowlist|open|disabled, got %q", policy)
} Type guard
func isValidGroupPolicy(v string) bool {
switch strings.ToLower(strings.TrimSpace(v)) {
case "", "allowlist", "open", "disabled": return true
}
return false
} Try / catch
plat, err := tuitui.New(opts)
if err != nil {
var cfgErr *InvalidConfigError
if errors.As(err, &cfgErr) {
return fmt.Errorf("fix config.toml: %v", cfgErr)
}
return err
} Prevention
- Copy allowed values only from config.example.toml or docs
- Normalize (lowercase+trim) config strings before use
- Remove the key to accept the default (allowlist)
- Add config schema validation at startup to catch all enum-like fields
When it happens
Trigger: Setting group_policy = "Allow List", "whitelist", "block", or any string not in the three-value set (after lowercase+trim) in the tuitui platform config.
Common situations: Copying policy vocabulary from another platform's config; typo like "allow-list" or "disable"; expecting a boolean-like true/false value; localization of the config file introducing translated words.
Understand the failure class
Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.
Related errors
- discord: invalid progress_style %q (want legacy, compact, or
- tuitui: invalid chat type %q
- tuitui: app_id and app_secret are required
- missing --chat
- missing --q
AI-assisted analysis of chenhg5/cc-connect@4000b2338a (2026-09-06).
Data as JSON: /api/errors/73fc4adc5067777d.
Report an issue: GitHub.