{"record":{"id":"6c9339740b1170c8","repo":"chenhg5/cc-connect","slug":"project-name-is-required","errorCode":null,"errorMessage":"project name is required","messagePattern":"project name is required","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"config/config.go","lineNumber":1905,"sourceCode":"\tProjectIndex     int\n\tPlatformAbsIndex int // absolute index in projects[i].platforms\n\tPlatformType     string\n\tAllowFrom        string\n}\n\n// EnsureProjectWithFeishuPlatform ensures target project exists. If project does\n// not exist, it creates one with a Feishu/Lark platform so credentials can be\n// 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)","sourceCodeStart":1887,"sourceCodeEnd":1923,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/config/config.go#L1887-L1923","documentation":"EnsureProjectWithFeishuPlatform requires a project name because it must locate or create a [[projects]] entry in the TOML config. When opts.ProjectName is empty (after trimming whitespace) the function cannot proceed and returns this error immediately after the config-path check.","triggerScenarios":"Calling config.EnsureProjectWithFeishuPlatform with opts.ProjectName set to \"\", a whitespace-only string (\" \"), or left unset in the EnsureProjectWithFeishuOptions struct.","commonSituations":"Programmatic callers building the options struct dynamically from an empty user input; forgetting to fill ProjectName when copying example code; passing a variable that was never populated from CLI flags or message payload.","solutions":["Set opts.ProjectName to a non-empty, trimmed name for the project in your config.toml.","Validate/trim user-provided project names at the caller before invoking the function.","Check that the variable feeding ProjectName is actually populated (e.g. flag or request field is not empty)."],"exampleFix":"// before\nopts := config.EnsureProjectWithFeishuOptions{} // ProjectName empty\n\n// after\nopts := config.EnsureProjectWithFeishuOptions{ProjectName: \"my-project\"}","handlingStrategy":"validation","validationCode":"name := strings.TrimSpace(opts.ProjectName)\nif name == \"\" {\n    return fmt.Errorf(\"project name must be provided\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Trim and validate user-supplied names at the boundary (CLI/chat command) before building options.","Make ProjectName a required field in your tooling's input parsing.","Never pass raw, unvalidated strings from message payloads into config APIs."],"tags":["config","go","validation"],"backgroundTag":"missing-required-argument","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"}