chenhg5/cc-connect · error

config: %s.references.enclosure_style has unsupported value

Error message

config: %s.references.enclosure_style has unsupported value %q

What it means

CC-Connect validates `[projects.references].enclosure_style` against a fixed set: "", "none", "bracket", "angle", "fullwidth", "code". Any other value makes validateReferenceConfig reject the config, quoting the value. It controls the characters wrapping each reference path (e.g. [path], <path>, `path`).

Source

Thrown at config/config.go:1156

		key := strings.ToLower(strings.TrimSpace(v))
		if _, ok := supportedReferenceAgents[key]; !ok {
			return fmt.Errorf("config: %s.references.normalize_agents has unsupported value %q", prefix, v)
		}
	}
	for _, v := range rc.RenderPlatforms {
		key := strings.ToLower(strings.TrimSpace(v))
		if _, ok := supportedReferencePlatforms[key]; !ok {
			return fmt.Errorf("config: %s.references.render_platforms has unsupported value %q", prefix, v)
		}
	}
	if _, ok := supportedReferenceDisplayPaths[strings.ToLower(strings.TrimSpace(rc.DisplayPath))]; !ok {
		return fmt.Errorf("config: %s.references.display_path has unsupported value %q", prefix, rc.DisplayPath)
	}
	if _, ok := supportedReferenceMarkerStyles[strings.ToLower(strings.TrimSpace(rc.MarkerStyle))]; !ok {
		return fmt.Errorf("config: %s.references.marker_style has unsupported value %q", prefix, rc.MarkerStyle)
	}
	if _, ok := supportedReferenceEnclosureStyles[strings.ToLower(strings.TrimSpace(rc.EnclosureStyle))]; !ok {
		return fmt.Errorf("config: %s.references.enclosure_style has unsupported value %q", prefix, rc.EnclosureStyle)
	}
	return nil
}

// validateUsersConfig checks the [projects.users] section for consistency.
func validateUsersConfig(prefix string, u *UsersConfig) error {
	if u == nil {
		return nil
	}
	if len(u.Roles) == 0 {
		return fmt.Errorf("config: %s.users has no roles defined", prefix)
	}
	wildcardCount := 0
	seenUserIDs := make(map[string]string) // userID → role name
	for roleName, rc := range u.Roles {
		if len(rc.UserIDs) == 0 {
			return fmt.Errorf("config: %s.users.roles.%s has empty user_ids", prefix, roleName)
		}

View on GitHub (pinned to 4000b2338a)

Solutions

  1. Use one of: "none", "bracket", "angle", "fullwidth", "code", or empty string for default
  2. Replace "backtick" with "code"; replace "square" with "bracket"
  3. Fix typos by copying a valid value exactly

Example fix

# before
[projects.references]
enclosure_style = "square"

# after
[projects.references]
enclosure_style = "bracket"
Defensive patterns

Strategy: validation

Validate before calling

var enclosureStyles = map[string]bool{"": true, "none": true, "bracket": true, "angle": true, "fullwidth": true, "code": true}
if !enclosureStyles[strings.ToLower(strings.TrimSpace(rc.EnclosureStyle))] {
    return fmt.Errorf("enclosure_style %q unsupported", rc.EnclosureStyle)
}

Type guard

func isValidEnclosureStyle(v string) bool {
    switch strings.ToLower(strings.TrimSpace(v)) {
    case "", "none", "bracket", "angle", "fullwidth", "code":
        return true
    }
    return false
}

Prevention

When it happens

Trigger: Loading config.toml with enclosure_style set to something like "square", "paren", or "backtick" instead of an allowed value. Matching is case-insensitive and trimmed, so "Bracket" would pass.

Common situations: Guessing bracket synonyms ("square", "curly", "parens"); mixing up with marker_style values ("ascii"/"emoji" are marker styles, not enclosures); typos.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


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