AlistGo/alist · error

delete root folder is not allowed, please goto the manage pa

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.

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)

Solutions

  1. Delete specific subpaths instead of the root
  2. To remove everything, delete and recreate the storage on the manage page
  3. 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

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


AI-assisted analysis of AlistGo/alist@843d9dc814 (2026-08-15). Data as JSON: /api/errors/48a0d811bccee67e. Report an issue: GitHub.