chenhg5/cc-connect · error
read config file: %w
Error message
read config file: %w
What it means
config.load wraps os.ReadFile failure on the config.toml path (missing file, permission denied, I/O error). This is the first step of every config load, so the error aborts startup or the command that needed the config.
Source
Thrown at config/config.go:623
// CommandConfig defines a user-customizable slash command that expands a prompt template or executes a shell command.
type CommandConfig struct {
Name string `toml:"name"`
Description string `toml:"description"`
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()View on GitHub (pinned to 4000b2338a)
Solutions
- Verify the --config path exists and is readable by the running user
- Run cc-connect init to generate a config file
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at config/config.go:623 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/682c5c3be56263fc.
Report an issue: GitHub.