sipeed/picoclaw · error

model_list[ ]

Error message

model_list[%d]: %w

What it means

Wrapper from Config.ValidateModelList: the model_list entry at the given index failed its own Validate() check (missing name, bad provider settings, invalid parameters). The wrapper preserves the index so the offending array element can be located.

Solutions

  1. Open config.json and inspect the model_list entry at the reported index
  2. Fix the field flagged by the wrapped inner error (name, provider, api key, base URL...)
  3. Re-validate after editing; duplicate model_name entries are allowed for load balancing
Defensive patterns

Strategy: validation

When it happens

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

Common situations: See trigger scenarios.


AI-assisted analysis of sipeed/picoclaw@49183d7e8d (2026-08-15). Data as JSON: /api/errors/0412fabfae9bea4b. Report an issue: GitHub.

Appendix: source

Thrown at pkg/config/config.go:1755

// findMatches finds all ModelConfig entries with the given model_name.
func (c *Config) findMatches(modelName string) []*ModelConfig {
	var matches []*ModelConfig
	for i := range c.ModelList {
		if c.ModelList[i].ModelName == modelName {
			matches = append(matches, c.ModelList[i])
		}
	}
	return matches
}

// ValidateModelList validates all ModelConfig entries in the model_list.
// It checks that each model config is valid.
// Note: Multiple entries with the same model_name are allowed for load balancing.
func (c *Config) ValidateModelList() error {
	for i := range c.ModelList {
		if err := c.ModelList[i].Validate(); err != nil {
			return fmt.Errorf("model_list[%d]: %w", i, err)
		}
	}
	return nil
}

func (c *Config) SecurityCopyFrom(path string) error {
	return loadSecurityConfig(c, securityPath(path))
}

// ResetToDefaults backs up the current config, creates a default config,
// preserves security credentials from the existing config, and saves it.
func ResetToDefaults(configPath string) error {
	if err := MakeBackup(configPath); err != nil {
		return fmt.Errorf("backup before reset: %w", err)
	}
	cfg := DefaultConfig()
	cfg.Session.ApplyDmScope()
	cfg.Session.DeriveDmScope()

View on GitHub (pinned to 49183d7e8d)