{"record":{"id":"7f345a38a8be73d3","repo":"gastownhall/beads","slug":"failed-to-remove-backup-w","errorCode":null,"errorMessage":"failed to remove backup: %w","messagePattern":"failed to remove backup: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/bd/backup_dolt.go","lineNumber":434,"sourceCode":"\t\t\t\tc.CloseEventAndAdd(evt)\n\t\t\t}\n\t\t}()\n\n\t\tctx := rootCtx\n\t\tif store == nil {\n\t\t\treturn fmt.Errorf(\"no store available\")\n\t\t}\n\n\t\tbs, ok := storage.UnwrapStore(store).(storage.BackupStore)\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"storage backend does not support backup operations\")\n\t\t}\n\n\t\tif err := bs.BackupRemove(ctx, defaultDoltBackupName); err != nil {\n\t\t\tif strings.Contains(err.Error(), \"not found\") || strings.Contains(err.Error(), \"no backup\") {\n\t\t\t\treturn fmt.Errorf(\"no backup destination configured\")\n\t\t\t}\n\t\t\treturn fmt.Errorf(\"failed to remove backup: %w\", err)\n\t\t}\n\n\t\t// Also remove backup_export if it exists (auto-export may have created it at same URL)\n\t\t_ = bs.BackupRemove(ctx, \"backup_export\")\n\n\t\t// Remove local config\n\t\tif path, err := doltBackupConfigPath(); err == nil {\n\t\t\t_ = os.Remove(path)\n\t\t}\n\t\tif path, err := doltBackupStatePath(); err == nil {\n\t\t\t_ = os.Remove(path)\n\t\t}\n\n\t\tif jsonOutput {\n\t\t\treturn outputJSON(map[string]interface{}{\"removed\": true})\n\t\t}\n\n\t\tfmt.Println(\"Backup destination removed.\")","sourceCodeStart":416,"sourceCodeEnd":452,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/cmd/bd/backup_dolt.go#L416-L452","documentation":"When bs.BackupRemove fails with an error that is not a benign 'not found' (i.e. does not contain 'not found' or 'no backup'), the command wraps it as 'failed to remove backup: %w' preserving the underlying cause. This indicates a real failure talking to the Dolt backup subsystem — bad URL, network issue to the remote, permissions, or driver error.","triggerScenarios":"Running `bd backup remove` when the underlying Dolt BackupRemove call errors for reasons other than absence: unreachable backup remote URL, authentication failure, corrupt local Dolt state, or filesystem errors.","commonSituations":"Backup remote was decommissioned or URL changed (connection refused/timeouts), credentials rotated, network offline, or the local .dolt directory is corrupted.","solutions":["Read the wrapped cause after '%w' to identify the root error (network vs permissions vs state)","Verify the backup remote URL is reachable (curl / dolt backup list) and credentials are valid","If the remote is permanently gone, manually delete the local dolt-backup.json config and any local backup registration","Retry after network is restored"],"exampleFix":"// before\nbd backup remove\n// error: failed to remove backup: dial tcp: connection refused\n// after: point at a live remote or clean local state\ndolt backup remove <name>  # or fix URL, then\nbd backup remove","handlingStrategy":"retry","validationCode":"// pre-check remote reachability\nif !isBackupRemoteReachable(backupURL) {\n    return errors.New(\"backup remote unreachable; fix URL/credentials before removing\")\n}","typeGuard":null,"tryCatchPattern":"err := bs.BackupRemove(ctx, defaultDoltBackupName)\nif err != nil && !isNotFound(err) {\n    var netErr net.Error\n    if errors.As(err, &netErr) {\n        // retry with backoff or report network problem\n    }\n    return fmt.Errorf(\"failed to remove backup: %w\", err)\n}","preventionTips":["Keep backup remote URLs valid and reachable; test with a dry-run before removal","Handle network outages with bounded retries","Inspect the wrapped cause (%w) rather than the top-level message"],"tags":["go","dolt","network","backup"],"backgroundTag":"backup-remove-failed","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}