{"record":{"id":"6dc98403beb40ece","repo":"sipeed/picoclaw","slug":"failed-to-create-config-backup-w","errorCode":null,"errorMessage":"failed to create config backup: %w","messagePattern":"failed to create config backup: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/config/config.go","lineNumber":1646,"sourceCode":"\t\tgithubCfg.AuthToken = *NewSecureString(value)\n\t}\n\tif value, envSet := os.LookupEnv(envSkillsGitHubProxy); envSet {\n\t\tgithubCfg.Param[\"proxy\"] = value\n\t}\n\n\tcfg.Tools.Skills.Registries.Set(\"github\", githubCfg)\n}\n\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","sourceCodeStart":1628,"sourceCodeEnd":1664,"githubUrl":"https://github.com/sipeed/picoclaw/blob/49183d7e8daed0dba89ddbb6fcb60089401d9680/pkg/config/config.go#L1628-L1664","documentation":"Raised by MakeBackup when copying the existing config file to its dated .bak copy fails (read/write/permission error). The backup step aborts so a reset or save never proceeds without a recoverable copy of the previous config.","triggerScenarios":"Thrown at pkg/config/config.go:1646 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check file permissions on the config file and its directory","Verify sufficient disk space for the backup copy","Remove stale .bak files or locks in the config directory","Create the backup manually before retrying the operation"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"49183d7e8daed0dba89ddbb6fcb60089401d9680","analyzedAt":"2026-08-15T21:55:41.315Z","contentChangedAt":"2026-08-15T21:55:41.315Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}