{"record":{"id":"25d5a6aa4e81c577","repo":"portainer/portainer","slug":"failed-to-delete-destination-directory-w","errorCode":null,"errorMessage":"failed to delete destination directory: %w","messagePattern":"failed to delete destination directory: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"api/filesystem/filesystem.go","lineNumber":961,"sourceCode":"\t\treturn fmt.Errorf(\"failed to copy backup directory to destination directory: %w\", err)\n\t}\n\n\t// 3. Delete the backup directory\n\terr = os.RemoveAll(backupDir)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to delete backup directory: %w\", err)\n\t}\n\n\treturn nil\n}\n\nfunc restoreBackup(src, backupDir string) error {\n\t// Rollback by deleting the original directory and copying the\n\t// backup direcotry back to the source directory, and then deleting\n\t// the backup directory\n\terr := os.RemoveAll(src)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to delete destination directory: %w\", err)\n\t}\n\n\terr = MoveDirectory(backupDir, src, false)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to restore backup directory: %w\", err)\n\t}\n\treturn nil\n}\n\nfunc MoveDirectory(originalPath, newPath string, overwriteTargetPath bool) error {\n\tif _, err := os.Stat(originalPath); err != nil {\n\t\treturn err\n\t}\n\n\talreadyExists, err := FileExists(newPath)\n\tif err != nil {\n\t\treturn err\n\t}","sourceCodeStart":943,"sourceCodeEnd":979,"githubUrl":"https://github.com/portainer/portainer/blob/17e74456ff6e794b9d5439ec3fa06922aa18a3f8/api/filesystem/filesystem.go#L943-L979","documentation":"Error \"failed to delete destination directory: %w\" thrown in portainer/portainer.","triggerScenarios":"Thrown at api/filesystem/filesystem.go:961 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":"17e74456ff6e794b9d5439ec3fa06922aa18a3f8","analyzedAt":"2026-08-26T23:09:01.915Z","schemaVersion":2},"datasetVersion":"2026-08-27T03:17:27.898Z"}