chenhg5/cc-connect · error
project name is required
Error message
project name is required
What it means
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.
Source
Thrown at config/config.go:1905
ProjectIndex int
PlatformAbsIndex int // absolute index in projects[i].platforms
PlatformType string
AllowFrom string
}
// EnsureProjectWithFeishuPlatform ensures target project exists. If project does
// not exist, it creates one with a Feishu/Lark platform so credentials can be
// written immediately.
func EnsureProjectWithFeishuPlatform(opts EnsureProjectWithFeishuOptions) (*EnsureProjectWithFeishuResult, error) {
configMu.Lock()
defer configMu.Unlock()
if ConfigPath == "" {
return nil, fmt.Errorf("config path not set")
}
projectName := strings.TrimSpace(opts.ProjectName)
if projectName == "" {
return nil, fmt.Errorf("project name is required")
}
platformType := strings.ToLower(strings.TrimSpace(opts.PlatformType))
if platformType == "" {
platformType = "feishu"
}
if platformType != "feishu" && platformType != "lark" {
return nil, fmt.Errorf("invalid platform type %q (want feishu or lark)", opts.PlatformType)
}
data, err := os.ReadFile(ConfigPath)
if err != nil {
return nil, fmt.Errorf("read config: %w", err)
}
raw := string(data)
cfg := &Config{}
if err := toml.Unmarshal(data, cfg); err != nil {
return nil, fmt.Errorf("parse config: %w", err)View on GitHub (pinned to 4000b2338a)
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).
Example fix
// before
opts := config.EnsureProjectWithFeishuOptions{} // ProjectName empty
// after
opts := config.EnsureProjectWithFeishuOptions{ProjectName: "my-project"} Defensive patterns
Strategy: validation
Validate before calling
name := strings.TrimSpace(opts.ProjectName)
if name == "" {
return fmt.Errorf("project name must be provided")
} Prevention
- 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.
When it happens
Trigger: Calling config.EnsureProjectWithFeishuPlatform with opts.ProjectName set to "", a whitespace-only string (" "), or left unset in the EnsureProjectWithFeishuOptions struct.
Common situations: 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.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- tmux: 'session' option is required (name of the tmux session
- config: relay.visibility must be "full", "summary", or "none
- config: at least one [[projects]] entry is required
- config: %s.name is required
- config: %s.agent.type is required
AI-assisted analysis of chenhg5/cc-connect@4000b2338a (2026-09-06).
Data as JSON: /api/errors/6c9339740b1170c8.
Report an issue: GitHub.