chenhg5/cc-connect · error

parse minimax config: %w

Error message

parse minimax config: %w

What it means

LoadMiniMaxLocalConfig could not parse the MiniMax JSON config file (minimax.json) — malformed JSON or wrong schema. Distinguishes a parse failure from a missing file (missing returns an empty config with no error).

Source

Thrown at config/config.go:416

}

// LoadMiniMaxLocalConfig reads a MiniMax JSON config without exposing secrets.
// It returns an empty config when the file does not exist.
func LoadMiniMaxLocalConfig(dataDir, configFile string) (MiniMaxLocalConfig, error) {
	if strings.TrimSpace(configFile) == "" {
		configFile = filepath.Join(dataDir, "config", "minimax.json")
	}
	configFile = expandUserPath(configFile)
	data, err := os.ReadFile(configFile)
	if err != nil {
		if os.IsNotExist(err) {
			return MiniMaxLocalConfig{}, nil
		}
		return MiniMaxLocalConfig{}, fmt.Errorf("read minimax config: %w", err)
	}
	var cfg MiniMaxLocalConfig
	if err := json.Unmarshal(data, &cfg); err != nil {
		return MiniMaxLocalConfig{}, fmt.Errorf("parse minimax config: %w", err)
	}
	return cfg, nil
}

func expandUserPath(path string) string {
	// Only the current user's home shorthand is expanded; ~user paths are left
	// unchanged to avoid platform-specific user lookup behavior.
	if path == "~" {
		if home, err := os.UserHomeDir(); err == nil {
			return home
		}
	}
	if strings.HasPrefix(path, "~/") {
		if home, err := os.UserHomeDir(); err == nil {
			return filepath.Join(home, path[2:])
		}
	}
	return path

View on GitHub (pinned to 4000b2338a)

Solutions

  1. Fix JSON syntax in minimax.json (validate with a linter)
  2. Delete the file to fall back to an empty/default config
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at config/config.go:416 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/a9e44a0e1d963c81. Report an issue: GitHub.