AlistGo/alist · warning
label have binding relationships
Error message
label have binding relationships
What it means
DeleteLabelById refuses to delete a label that still has file-binding relationships for the user, checked via db.GetLabelFileBinDingByLabelIdExists(id, userId). Deleting would orphan those bindings, so the op requires the label to be unbound first. The label itself is confirmed to exist before this check.
Source
Thrown at internal/op/label.go:16
package op
import (
"context"
"github.com/alist-org/alist/v3/internal/db"
"github.com/pkg/errors"
)
func DeleteLabelById(ctx context.Context, id, userId uint) error {
_, err := db.GetLabelById(id)
if err != nil {
return errors.WithMessage(err, "failed get label")
}
if db.GetLabelFileBinDingByLabelIdExists(id, userId) {
return errors.New("label have binding relationships")
}
// delete the label in the database
if err := db.DeleteLabelById(id); err != nil {
return errors.WithMessage(err, "failed delete label in database")
}
return nil
}
View on GitHub (pinned to 843d9dc814)
Solutions
- Remove the label from all files that use it, then retry the delete
- Use the UI's bulk unbind feature if available before deleting the label
- Check remaining bindings programmatically before offering delete in your own UI
Example fix
null
Defensive patterns
Strategy: validation
Validate before calling
// Before deleting a label
if db.GetLabelFileBinDingByLabelIdExists(labelId, userId) {
return errors.New("unbind label from all files first")
} Prevention
- Offer bulk-unbind in the UI before label deletion
- Show binding counts next to labels so users see the constraint
- Disable the delete button for bound labels
When it happens
Trigger: Calling op.DeleteLabelById(ctx, labelId, userId) while any file still carries that label (binding rows exist for that label id and user).
Common situations: Bulk-labeled files then attempting label cleanup; UI delete button hit without unbinding; shared labels across many objects.
Related errors
- url is required
- same-name files cannot be Delete
- delete root folder is not allowed, please goto the manage pa
- failed to delete qbittorrent task
- label name is exists
AI-assisted analysis of AlistGo/alist@843d9dc814 (2026-08-15).
Data as JSON: /api/errors/7e0d09cc5a87fc13.
Report an issue: GitHub.