{"record":{"id":"f9a3c4b15844d650","repo":"chenhg5/cc-connect","slug":"parse-config-w","errorCode":null,"errorMessage":"parse config: %w","messagePattern":"parse config: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"config/config.go","lineNumber":627,"sourceCode":"\tPrompt      string `toml:\"prompt\"`   // prompt template (mutually exclusive with Exec)\n\tExec        string `toml:\"exec\"`     // shell command to execute (mutually exclusive with Prompt)\n\tWorkDir     string `toml:\"work_dir\"` // optional: working directory for exec command\n}\n\ntype LogConfig struct {\n\tLevel string `toml:\"level\"`\n}\n\n// load parses, env-resolves, and wires providers in the config file but does\n// NOT validate — callers must call validate() or validatePermissive() themselves.\nfunc load(path string) (*Config, error) {\n\tdata, err := os.ReadFile(path)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"read config file: %w\", err)\n\t}\n\tcfg := &Config{Log: LogConfig{Level: \"info\"}}\n\tif err := toml.Unmarshal(data, cfg); err != nil {\n\t\treturn nil, fmt.Errorf(\"parse config: %w\", err)\n\t}\n\tresolveEnvInConfig(cfg)\n\tif cfg.DataDir == \"\" {\n\t\tif home, err := os.UserHomeDir(); err == nil {\n\t\t\tcfg.DataDir = filepath.Join(home, \".cc-connect\")\n\t\t} else {\n\t\t\tcfg.DataDir = \".cc-connect\"\n\t\t}\n\t}\n\tcfg.AttachmentSend = strings.ToLower(strings.TrimSpace(cfg.AttachmentSend))\n\tif cfg.AttachmentSend == \"\" {\n\t\tcfg.AttachmentSend = \"on\"\n\t}\n\tcfg.ResolveProviderRefs()\n\treturn cfg, nil\n}\n\n// LoadPermissive loads the config file and performs all validation except the","sourceCodeStart":609,"sourceCodeEnd":645,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/config/config.go#L609-L645","documentation":"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().","triggerScenarios":"Thrown at config/config.go:627 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Fix the TOML syntax at the reported line/key","Compare against config.example.toml for correct keys and types"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"4000b2338aa6e850c99df54f8b0ed6ed7460b401","analyzedAt":"2026-09-06T11:45:09.575Z","contentChangedAt":"2026-09-06T11:45:09.575Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}