AlistGo/alist · error
delete root folder is not allowed, please goto the manage…
Error message
delete root folder is not allowed, please goto the manage page to delete the storage instead
What it means
op.Remove refuses to delete the storage root path '/' because that operation would be interpreted by the driver as wiping the whole storage, not an emptying of a folder. The guard sits before any driver call, so it fires even for storages that would otherwise allow it. Users must delete the storage itself from the admin page instead.
Solutions
- Delete specific subpaths instead of the root
- To remove everything, delete and recreate the storage on the manage page
- Guard scripts/WebDAV clients from issuing DELETE on '/'
Example fix
// before err := op.Remove(ctx, storage, "/") // after dir := "/some/subdir" err := op.Remove(ctx, storage, dir)
Defensive patterns
Strategy: validation
Validate before calling
// Before any delete
if utils.PathEqual(path, "/") {
return errors.New("refusing to delete storage root")
} Prevention
- Reject root-path DELETEs in API/WebDAV adapters at the boundary
- Test cleanup scripts against '/' deliberately
- Use the manage page to remove whole storages
When it happens
Trigger: Any delete request (API, WebDAV DELETE, or copy/move cleanup) whose normalized path equals '/' on a mounted storage.
Common situations: WebDAV clients issuing recursive delete on the mount root; scripts globbing to '/'; users trying to 'empty' a storage by deleting its root.
Related errors
- can't move files between two storages, try to copy
- cannot copy parent dir to child
- cannot move parent dir to child
- DelDir failed, task status is
- delete failed
AI-assisted analysis of AlistGo/alist@843d9dc814 (2026-08-15).
Data as JSON: /api/errors/48a0d811bccee67e.
Report an issue: GitHub.
Appendix: source
Thrown at internal/op/fs.go:484
}
}
case driver.Copy:
err = s.Copy(ctx, srcObj, dstDir)
if err == nil && !utils.IsBool(lazyCache...) {
ClearCache(storage, dstDirPath)
}
default:
return errs.NotImplement
}
return errors.WithStack(err)
}
func Remove(ctx context.Context, storage driver.Driver, path string) error {
if storage.Config().CheckStatus && storage.GetStorage().Status != WORK {
return errors.Errorf("storage not init: %s", storage.GetStorage().Status)
}
if utils.PathEqual(path, "/") {
return errors.New("delete root folder is not allowed, please goto the manage page to delete the storage instead")
}
path = utils.FixAndCleanPath(path)
rawObj, err := Get(ctx, storage, path)
if err != nil {
// if object not found, it's ok
if errs.IsObjectNotFound(err) {
log.Debugf("%s have been removed", path)
return nil
}
return errors.WithMessage(err, "failed to get object")
}
dirPath := stdpath.Dir(path)
switch s := storage.(type) {
case driver.Remove:
err = s.Remove(ctx, model.UnwrapObj(rawObj))
if err == nil {
delCacheObj(storage, dirPath, rawObj)View on GitHub (pinned to 843d9dc814)