{"record":{"id":"4a46485b3dcf80f6","repo":"sipeed/picoclaw","slug":"reset-failed-w","errorCode":null,"errorMessage":"reset failed: %w","messagePattern":"reset failed: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/picoclaw/internal/config/command.go","lineNumber":45,"sourceCode":"\t\tUse:   \"reset\",\n\t\tShort: \"Reset configuration to factory defaults\",\n\t\tArgs:  cobra.NoArgs,\n\t\tExample: `  picoclaw config reset\n  picoclaw config reset --force`,\n\t\tRunE: func(_ *cobra.Command, _ []string) error {\n\t\t\tif !force {\n\t\t\t\tfmt.Print(\"Reset config to factory defaults? API keys will be preserved. (y/n): \")\n\t\t\t\tvar response string\n\t\t\t\tfmt.Scanln(&response)\n\t\t\t\tif strings.ToLower(strings.TrimSpace(response)) != \"y\" {\n\t\t\t\t\tfmt.Println(\"Aborted.\")\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconfigPath := internal.GetConfigPath()\n\t\t\tif err := config.ResetToDefaults(configPath); err != nil {\n\t\t\t\treturn fmt.Errorf(\"reset failed: %w\", err)\n\t\t\t}\n\t\t\tfmt.Println(\"Configuration has been reset to factory defaults.\")\n\t\t\tfmt.Println(\"A backup of the previous config was created in the same directory.\")\n\t\t\treturn nil\n\t\t},\n\t}\n\n\tcmd.Flags().BoolVarP(&force, \"force\", \"f\", false,\n\t\t\"Skip confirmation prompt\")\n\n\treturn cmd\n}\n","sourceCodeStart":27,"sourceCodeEnd":58,"githubUrl":"https://github.com/sipeed/picoclaw/blob/49183d7e8daed0dba89ddbb6fcb60089401d9680/cmd/picoclaw/internal/config/command.go#L27-L58","documentation":"`picoclaw config reset` (after its y/n confirmation, or immediately with -f/--force) calls config.ResetToDefaults(configPath), which first makes a backup (MakeBackup), preserves security settings, then saves DefaultConfig. This error wraps a failure anywhere in that chain. The inner message tells you which step failed; filesystem problems dominate.","triggerScenarios":"Running `picoclaw config reset` or `picoclaw config reset -f` when the backup copy cannot be created (read-only config directory, disk full) or SaveConfig cannot write the new file. The wrapped error 'backup before reset: ...' points at the backup step specifically.","commonSituations":"Read-only or root-owned config directory; disk full; config on a dropped network mount; container where the config home is not writable.","solutions":["Read the wrapped message: 'backup before reset:' means MakeBackup failed - restore writability of the config directory shown by `picoclaw config path`","Free disk space or fix ownership/permissions, then retry `picoclaw config reset -f`","If reset half-completed, restore the timestamped backup in the same directory","As a last resort, move the config aside and re-run onboarding to regenerate it"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"cfg_dir=$(dirname \"$(picoclaw config path)\")\n[ -w \"$cfg_dir\" ] && touch \"$cfg_dir/.write-test\" && rm \"$cfg_dir/.write-test\" || echo \"config dir not writable\"","typeGuard":null,"tryCatchPattern":"if err := config.ResetToDefaults(configPath); err != nil {\n    if strings.Contains(err.Error(), \"backup before reset\") {\n        // backup step failed: free space / fix permissions, old config is intact\n    } else {\n        // save failed: check the timestamped backup in the same directory before retrying\n    }\n}","preventionTips":["Check writability of the config directory before scripted resets","Keep disk headroom on the volume holding the config","Let reset finish before starting other picoclaw commands","Note where backups land (same directory) so a failed save is recoverable"],"tags":["config","cli","filesystem","backup"],"backgroundTag":null,"analyzedSha":"49183d7e8daed0dba89ddbb6fcb60089401d9680","analyzedAt":"2026-08-15T21:55:41.315Z","schemaVersion":2},"datasetVersion":"2026-08-16T03:17:38.424Z"}