chenhg5/cc-connect · error

parse config: %w

Error message

parse config: %w

What it means

config.load wraps TOML decode failure of the config file: syntax error or a value/type that does not fit the Config structs. load() parses before validation, so malformed TOML never reaches validate().

Source

Thrown at config/config.go:627

	Prompt      string `toml:"prompt"`   // prompt template (mutually exclusive with Exec)
	Exec        string `toml:"exec"`     // shell command to execute (mutually exclusive with Prompt)
	WorkDir     string `toml:"work_dir"` // optional: working directory for exec command
}

type LogConfig struct {
	Level string `toml:"level"`
}

// load parses, env-resolves, and wires providers in the config file but does
// NOT validate — callers must call validate() or validatePermissive() themselves.
func load(path string) (*Config, error) {
	data, err := os.ReadFile(path)
	if err != nil {
		return nil, fmt.Errorf("read config file: %w", err)
	}
	cfg := &Config{Log: LogConfig{Level: "info"}}
	if err := toml.Unmarshal(data, cfg); err != nil {
		return nil, fmt.Errorf("parse config: %w", err)
	}
	resolveEnvInConfig(cfg)
	if cfg.DataDir == "" {
		if home, err := os.UserHomeDir(); err == nil {
			cfg.DataDir = filepath.Join(home, ".cc-connect")
		} else {
			cfg.DataDir = ".cc-connect"
		}
	}
	cfg.AttachmentSend = strings.ToLower(strings.TrimSpace(cfg.AttachmentSend))
	if cfg.AttachmentSend == "" {
		cfg.AttachmentSend = "on"
	}
	cfg.ResolveProviderRefs()
	return cfg, nil
}

// LoadPermissive loads the config file and performs all validation except the

View on GitHub (pinned to 4000b2338a)

Solutions

  1. Fix the TOML syntax at the reported line/key
  2. Compare against config.example.toml for correct keys and types
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at config/config.go:627 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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