chenhg5/cc-connect · error

config: %s.name is required

Error message

config: %s.name is required

What it means

Each [[projects]] entry must have a non-empty name, used as the project identifier in sessions, logs, and error messages. The validator iterates c.Projects and rejects any entry whose Name field is empty, reporting the index via the projects[%d] prefix.

Source

Thrown at config/config.go:1029

	case "", "on", "off":
	default:
		return fmt.Errorf("config: attachment_send must be \"on\" or \"off\"")
	}
	if c.Relay.TimeoutSecs != nil && *c.Relay.TimeoutSecs < 0 {
		return fmt.Errorf("config: relay.timeout_secs must be >= 0")
	}
	switch strings.ToLower(strings.TrimSpace(c.Relay.Visibility)) {
	case "", "full", "summary", "none":
	default:
		return fmt.Errorf("config: relay.visibility must be \"full\", \"summary\", or \"none\"")
	}
	if len(c.Projects) == 0 {
		return fmt.Errorf("config: at least one [[projects]] entry is required")
	}
	for i, proj := range c.Projects {
		prefix := fmt.Sprintf("projects[%d]", i)
		if proj.Name == "" {
			return fmt.Errorf("config: %s.name is required", prefix)
		}
		if proj.Agent.Type == "" {
			return fmt.Errorf("config: %s.agent.type is required", prefix)
		}
		if len(proj.Platforms) == 0 && !permissive {
			return fmt.Errorf("config: %s needs at least one [[projects.platforms]]", prefix)
		}
		for j, p := range proj.Platforms {
			if p.Type == "" {
				return fmt.Errorf("config: %s.platforms[%d].type is required", prefix, j)
			}
		}
		if proj.Mode == "multi-workspace" {
			if proj.BaseDir == "" {
				return fmt.Errorf("project %q: multi-workspace mode requires base_dir", proj.Name)
			}
			if _, ok := proj.Agent.Options["work_dir"]; ok {
				return fmt.Errorf("project %q: multi-workspace mode conflicts with agent work_dir (use base_dir instead)", proj.Name)

View on GitHub (pinned to 4000b2338a)

Solutions

  1. Set a non-empty name in the offending [[projects]] block (index shown in the message, e.g. projects[2])
  2. Check that the name key is at the project level, not nested under agent or platforms
  3. Verify the TOML array-of-tables syntax is correct so fields bind to the right entry

Example fix

// before
[[projects]]
name = ""
agent.type = "claudecode"
// after
[[projects]]
name = "my-app"
agent.type = "claudecode"
Defensive patterns

Strategy: validation

Validate before calling

for i, p := range cfg.Projects {
    if strings.TrimSpace(p.Name) == "" {
        return fmt.Errorf("projects[%d].name is empty", i)
    }
}

Prevention

When it happens

Trigger: A [[projects]] block exists but its name key is missing, set to an empty string (name = ""), or the TOML structure is malformed so the name field never deserializes into the Project struct.

Common situations: Copy-pasting a project block and forgetting to fill in name; renaming a project by clearing the value; whitespace-only names are NOT trimmed here — a name of " " also passes TOML but note only truly empty "" triggers this.

Understand the failure class

Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.

Related errors


AI-assisted analysis of chenhg5/cc-connect@4000b2338a (2026-09-06). Data as JSON: /api/errors/98bd97bed61cb2a5. Report an issue: GitHub.