{"record":{"id":"9f11e0ea85ea5928","repo":"chenhg5/cc-connect","slug":"read-minimax-config-w","errorCode":null,"errorMessage":"read minimax config: %w","messagePattern":"read minimax config: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"config/config.go","lineNumber":412,"sourceCode":"type MiniMaxLocalConfig struct {\n\tAPIKey  string `json:\"api_key\"`\n\tAPIHost string `json:\"api_host\"`\n\tBaseURL string `json:\"base_url\"`\n}\n\n// LoadMiniMaxLocalConfig reads a MiniMax JSON config without exposing secrets.\n// It returns an empty config when the file does not exist.\nfunc LoadMiniMaxLocalConfig(dataDir, configFile string) (MiniMaxLocalConfig, error) {\n\tif strings.TrimSpace(configFile) == \"\" {\n\t\tconfigFile = filepath.Join(dataDir, \"config\", \"minimax.json\")\n\t}\n\tconfigFile = expandUserPath(configFile)\n\tdata, err := os.ReadFile(configFile)\n\tif err != nil {\n\t\tif os.IsNotExist(err) {\n\t\t\treturn MiniMaxLocalConfig{}, nil\n\t\t}\n\t\treturn MiniMaxLocalConfig{}, fmt.Errorf(\"read minimax config: %w\", err)\n\t}\n\tvar cfg MiniMaxLocalConfig\n\tif err := json.Unmarshal(data, &cfg); err != nil {\n\t\treturn MiniMaxLocalConfig{}, fmt.Errorf(\"parse minimax config: %w\", err)\n\t}\n\treturn cfg, nil\n}\n\nfunc expandUserPath(path string) string {\n\t// Only the current user's home shorthand is expanded; ~user paths are left\n\t// unchanged to avoid platform-specific user lookup behavior.\n\tif path == \"~\" {\n\t\tif home, err := os.UserHomeDir(); err == nil {\n\t\t\treturn home\n\t\t}\n\t}\n\tif strings.HasPrefix(path, \"~/\") {\n\t\tif home, err := os.UserHomeDir(); err == nil {","sourceCodeStart":394,"sourceCodeEnd":430,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/config/config.go#L394-L430","documentation":"LoadMiniMaxLocalConfig wraps a non-ENOENT os.ReadFile failure on the minimax.json file (permission denied, path is a directory, I/O error). A missing file is intentionally tolerated (empty config returned); only real read errors reach this wrapper.","triggerScenarios":"Thrown at config/config.go:412 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check permissions/ownership of the minimax.json path","Verify the configured config file points to a regular readable file"],"exampleFix":null,"handlingStrategy":"try-catch","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-14T00:17:10.932Z"}