sipeed/picoclaw · error
reset failed: %w
Error message
reset failed: %w
What it means
`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.
Source
Thrown at cmd/picoclaw/internal/config/command.go:45
Use: "reset",
Short: "Reset configuration to factory defaults",
Args: cobra.NoArgs,
Example: ` picoclaw config reset
picoclaw config reset --force`,
RunE: func(_ *cobra.Command, _ []string) error {
if !force {
fmt.Print("Reset config to factory defaults? API keys will be preserved. (y/n): ")
var response string
fmt.Scanln(&response)
if strings.ToLower(strings.TrimSpace(response)) != "y" {
fmt.Println("Aborted.")
return nil
}
}
configPath := internal.GetConfigPath()
if err := config.ResetToDefaults(configPath); err != nil {
return fmt.Errorf("reset failed: %w", err)
}
fmt.Println("Configuration has been reset to factory defaults.")
fmt.Println("A backup of the previous config was created in the same directory.")
return nil
},
}
cmd.Flags().BoolVarP(&force, "force", "f", false,
"Skip confirmation prompt")
return cmd
}
View on GitHub (pinned to 49183d7e8d)
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
Defensive patterns
Strategy: try-catch
Validate before calling
cfg_dir=$(dirname "$(picoclaw config path)") [ -w "$cfg_dir" ] && touch "$cfg_dir/.write-test" && rm "$cfg_dir/.write-test" || echo "config dir not writable"
Try / catch
if err := config.ResetToDefaults(configPath); err != nil {
if strings.Contains(err.Error(), "backup before reset") {
// backup step failed: free space / fix permissions, old config is intact
} else {
// save failed: check the timestamped backup in the same directory before retrying
}
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: Read-only or root-owned config directory; disk full; config on a dropped network mount; container where the config home is not writable.
Related errors
- failed to load config: %w
- failed to save config: %w
- local command %q is a directory
- local command %q is not executable
- failed to save config: %w
AI-assisted analysis of sipeed/picoclaw@49183d7e8d (2026-08-15).
Data as JSON: /api/errors/4a46485b3dcf80f6.
Report an issue: GitHub.