{"record":{"id":"451594421642a4f1","repo":"chenhg5/cc-connect","slug":"invalid-platform-type-q-want-feishu-or-lark-451594","errorCode":null,"errorMessage":"invalid platform type %q (want feishu or lark)","messagePattern":"invalid platform type %q \\(want feishu or lark\\)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"config/config.go","lineNumber":1913,"sourceCode":"// written immediately.\nfunc EnsureProjectWithFeishuPlatform(opts EnsureProjectWithFeishuOptions) (*EnsureProjectWithFeishuResult, error) {\n\tconfigMu.Lock()\n\tdefer configMu.Unlock()\n\n\tif ConfigPath == \"\" {\n\t\treturn nil, fmt.Errorf(\"config path not set\")\n\t}\n\tprojectName := strings.TrimSpace(opts.ProjectName)\n\tif projectName == \"\" {\n\t\treturn nil, fmt.Errorf(\"project name is required\")\n\t}\n\n\tplatformType := strings.ToLower(strings.TrimSpace(opts.PlatformType))\n\tif platformType == \"\" {\n\t\tplatformType = \"feishu\"\n\t}\n\tif platformType != \"feishu\" && platformType != \"lark\" {\n\t\treturn nil, fmt.Errorf(\"invalid platform type %q (want feishu or lark)\", opts.PlatformType)\n\t}\n\n\tdata, err := os.ReadFile(ConfigPath)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"read config: %w\", err)\n\t}\n\traw := string(data)\n\tcfg := &Config{}\n\tif err := toml.Unmarshal(data, cfg); err != nil {\n\t\treturn nil, fmt.Errorf(\"parse config: %w\", err)\n\t}\n\n\tfor i := range cfg.Projects {\n\t\tif cfg.Projects[i].Name != projectName {\n\t\t\tcontinue\n\t\t}\n\t\tplatformIdx := firstFeishuPlatformIndex(cfg.Projects[i].Platforms)\n\t\tadded := false","sourceCodeStart":1895,"sourceCodeEnd":1931,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/config/config.go#L1895-L1931","documentation":"The platform type argument is validated against the two supported values, \"feishu\" and \"lark\" (case-insensitive; empty defaults to \"feishu\"). Any other string is rejected with the original (untrimmed, un-lowercased) value quoted, so callers know exactly what they passed.","triggerScenarios":"Calling config.EnsureProjectWithFeishuPlatform with opts.PlatformType set to anything other than \"feishu\"/\"lark\" in any casing, e.g. \"Feishu cloud\", \"larksuite\", \"feishu_cn\", or a typo like \"fieshu\".","commonSituations":"Typing the platform name by hand in a config-generation tool; using \"larksuite\" assuming it is a synonym; copying a platform slug from another project that uses different naming.","solutions":["Set opts.PlatformType to exactly \"feishu\" or \"lark\" (case does not matter).","Leave opts.PlatformType empty to get the default \"feishu\".","Normalize the value at the caller with strings.ToLower(strings.TrimSpace(...)) and match against the two allowed values before calling."],"exampleFix":"// before\nopts := config.EnsureProjectWithFeishuOptions{ProjectName: \"p\", PlatformType: \"larksuite\"}\n\n// after\nopts := config.EnsureProjectWithFeishuOptions{ProjectName: \"p\", PlatformType: \"lark\"}","handlingStrategy":"validation","validationCode":"pt := strings.ToLower(strings.TrimSpace(opts.PlatformType))\nif pt != \"\" && pt != \"feishu\" && pt != \"lark\" {\n    return fmt.Errorf(\"unsupported platform type %q\", opts.PlatformType)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Expose only feishu/lark (or empty) in your UI/CLI so invalid values cannot be entered.","Normalize with strings.ToLower(strings.TrimSpace(...)) at input boundaries.","Keep a shared allowed-values constant in your caller code."],"tags":["config","go","validation","enum"],"backgroundTag":"invalid-enum-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"}