{"record":{"id":"6ecc719ea0e06686","repo":"sipeed/picoclaw","slug":"backup-before-reset-w","errorCode":null,"errorMessage":"backup before reset: %w","messagePattern":"backup before reset: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/config/config.go","lineNumber":1769,"sourceCode":"// Note: Multiple entries with the same model_name are allowed for load balancing.\nfunc (c *Config) ValidateModelList() error {\n\tfor i := range c.ModelList {\n\t\tif err := c.ModelList[i].Validate(); err != nil {\n\t\t\treturn fmt.Errorf(\"model_list[%d]: %w\", i, err)\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (c *Config) SecurityCopyFrom(path string) error {\n\treturn loadSecurityConfig(c, securityPath(path))\n}\n\n// ResetToDefaults backs up the current config, creates a default config,\n// preserves security credentials from the existing config, and saves it.\nfunc ResetToDefaults(configPath string) error {\n\tif err := MakeBackup(configPath); err != nil {\n\t\treturn fmt.Errorf(\"backup before reset: %w\", err)\n\t}\n\tcfg := DefaultConfig()\n\tcfg.Session.ApplyDmScope()\n\tcfg.Session.DeriveDmScope()\n\tif err := cfg.SecurityCopyFrom(configPath); err != nil {\n\t\tlogger.WarnF(\"could not preserve security config\", map[string]any{\"error\": err})\n\t}\n\treturn SaveConfig(configPath, cfg)\n}\n\nfunc expandMultiKeyModels(models []*ModelConfig) []*ModelConfig {\n\tvar expanded []*ModelConfig\n\n\tfor _, m := range models {\n\t\tkeys := m.APIKeys.Values()\n\n\t\t// Single key or no keys: keep as-is\n\t\tif len(keys) <= 1 {","sourceCodeStart":1751,"sourceCodeEnd":1787,"githubUrl":"https://github.com/sipeed/picoclaw/blob/49183d7e8daed0dba89ddbb6fcb60089401d9680/pkg/config/config.go#L1751-L1787","documentation":"Error \"backup before reset: %w\" thrown in sipeed/picoclaw.","triggerScenarios":"Thrown at pkg/config/config.go:1769 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"49183d7e8daed0dba89ddbb6fcb60089401d9680","analyzedAt":"2026-08-15T21:55:41.315Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}