{"record":{"id":"d6e7ba4ebda1dfa1","repo":"sipeed/picoclaw","slug":"failed-to-create-security-backup-w","errorCode":null,"errorMessage":"failed to create security backup: %w","messagePattern":"failed to create security backup: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/config/config.go","lineNumber":1654,"sourceCode":"\nfunc MakeBackup(path string) error {\n\tif _, err := os.Stat(path); os.IsNotExist(err) {\n\t\treturn nil\n\t}\n\tdateSuffix := time.Now().Format(\".20060102.bak\")\n\t// Backup config file\n\tbakPath := path + dateSuffix\n\tif err := fileutil.CopyFile(path, bakPath, 0o600); err != nil {\n\t\tlogger.ErrorF(\"failed to create config backup\", map[string]any{\"error\": err})\n\t\treturn fmt.Errorf(\"failed to create config backup: %w\", err)\n\t}\n\t// Backup security config file\n\tsecPath := securityPath(path)\n\tif _, err := os.Stat(secPath); err == nil {\n\t\tsecBakPath := secPath + dateSuffix\n\t\tif secErr := fileutil.CopyFile(secPath, secBakPath, 0o600); secErr != nil {\n\t\t\tlogger.ErrorF(\"failed to create security backup\", map[string]any{\"error\": secErr})\n\t\t\treturn fmt.Errorf(\"failed to create security backup: %w\", secErr)\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc toNameIndex(list []*ModelConfig) []string {\n\tnameList := make([]string, 0, len(list))\n\tcountMap := make(map[string]int)\n\tfor _, model := range list {\n\t\tname := model.ModelName\n\t\tindex := countMap[name]\n\t\tnameList = append(nameList, fmt.Sprintf(\"%s:%d\", name, index))\n\t\tcountMap[name]++\n\t}\n\treturn nameList\n}\n\nfunc SaveConfig(path string, cfg *Config) error {","sourceCodeStart":1636,"sourceCodeEnd":1672,"githubUrl":"https://github.com/sipeed/picoclaw/blob/49183d7e8daed0dba89ddbb6fcb60089401d9680/pkg/config/config.go#L1636-L1672","documentation":"Error \"failed to create security backup: %w\" thrown in sipeed/picoclaw.","triggerScenarios":"Thrown at pkg/config/config.go:1654 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"}