{"record":{"id":"73fc4adc5067777d","repo":"chenhg5/cc-connect","slug":"tuitui-invalid-group-policy-q-want-allowlist-o","errorCode":null,"errorMessage":"tuitui: invalid group_policy %q (want allowlist, open, or disabled)","messagePattern":"tuitui: invalid group_policy %q \\(want allowlist, open, or disabled\\)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"platform/tuitui/tuitui.go","lineNumber":131,"sourceCode":"\t\tapiBase = defaultAPIBase\n\t}\n\twsBase, _ := opts[\"ws_base\"].(string)\n\tif wsBase == \"\" {\n\t\twsBase = defaultWSBase\n\t}\n\tallowFrom, _ := opts[\"allow_from\"].(string)\n\tcore.CheckAllowFrom(\"tuitui\", allowFrom)\n\tgroupAllowFrom, _ := opts[\"group_allow_from\"].(string)\n\tignoreFrom, _ := opts[\"ignore_from\"].(string)\n\tgroupPolicy, _ := opts[\"group_policy\"].(string)\n\tif groupPolicy == \"\" {\n\t\tgroupPolicy = \"allowlist\"\n\t}\n\tgroupPolicy = strings.ToLower(strings.TrimSpace(groupPolicy))\n\tswitch groupPolicy {\n\tcase \"allowlist\", \"open\", \"disabled\":\n\tdefault:\n\t\treturn nil, fmt.Errorf(\"tuitui: invalid group_policy %q (want allowlist, open, or disabled)\", groupPolicy)\n\t}\n\trequireMention := true\n\tif v, ok := opts[\"require_mention\"].(bool); ok {\n\t\trequireMention = v\n\t}\n\treceiveReaction := \"收到\"\n\tif v, ok := opts[\"receive_reaction\"].(string); ok {\n\t\treceiveReaction = strings.TrimSpace(v)\n\t}\n\tshareSessionInChannel, _ := opts[\"share_session_in_channel\"].(bool)\n\tpendingHistoryLimit := defaultHistoryLimit\n\tif v, ok := intOption(opts[\"history_limit\"]); ok {\n\t\tif v < 0 {\n\t\t\treturn nil, fmt.Errorf(\"tuitui: history_limit must be non-negative\")\n\t\t}\n\t\tpendingHistoryLimit = v\n\t}\n","sourceCodeStart":113,"sourceCodeEnd":149,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/platform/tuitui/tuitui.go#L113-L149","documentation":"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.","triggerScenarios":"Setting group_policy = \"Allow List\", \"whitelist\", \"block\", or any string not in the three-value set (after lowercase+trim) in the tuitui platform config.","commonSituations":"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.","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."],"exampleFix":"// before\ngroup_policy = \"whitelist\"\n// after\ngroup_policy = \"allowlist\"","handlingStrategy":"validation","validationCode":"var validPolicies = map[string]bool{\"allowlist\": true, \"open\": true, \"disabled\": true}\npolicy := strings.ToLower(strings.TrimSpace(cfg[\"group_policy\"]))\nif policy != \"\" && !validPolicies[policy] {\n    return fmt.Errorf(\"group_policy must be allowlist|open|disabled, got %q\", policy)\n}","typeGuard":"func isValidGroupPolicy(v string) bool {\n    switch strings.ToLower(strings.TrimSpace(v)) {\n    case \"\", \"allowlist\", \"open\", \"disabled\": return true\n    }\n    return false\n}","tryCatchPattern":"plat, err := tuitui.New(opts)\nif err != nil {\n    var cfgErr *InvalidConfigError\n    if errors.As(err, &cfgErr) {\n        return fmt.Errorf(\"fix config.toml: %v\", cfgErr)\n    }\n    return err\n}","preventionTips":["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"],"tags":["tuitui","configuration","enum"],"backgroundTag":"invalid-config-value","analyzedSha":"4000b2338aa6e850c99df54f8b0ed6ed7460b401","analyzedAt":"2026-09-06T11:45:09.575Z","contentChangedAt":"2026-09-06T11:45:09.575Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}