juicedata/juicefs · error

only %d acls inserted, expected %d

Error message

only %d acls inserted, expected %d

What it means

The batch INSERT of ACLs during metadata load reported fewer affected rows than the number of acl records submitted. Indicates a partial insert (database quirk or row-level failure) that would leave the ACL table incomplete, so the transaction is failed rather than committed.

Source

Thrown at pkg/meta/sql.go:6017

	acls := make([]*acl, 0, len(id2Rule))
	maxID := uint32(0)
	for id, rule := range id2Rule {
		aclV := newSQLAcl(rule)
		aclV.Id = id
		acls = append(acls, aclV)
		if id > maxID {
			maxID = id
		}
	}

	return m.txn(func(s *xorm.Session) error {
		n, err := s.Insert(acls)
		if err != nil {
			return err
		}
		if int(n) != len(acls) {
			return fmt.Errorf("only %d acls inserted, expected %d", n, len(acls))
		}
		m.genLog(ctx, s, time.Now().UnixNano(), "LOADDUMPEDACLS(%d)", maxID)
		return nil
	})
}

func (m *dbMeta) doStoreToken(ctx Context, token []byte) (id uint32, st syscall.Errno) {
	err := m.txn(func(s *xorm.Session) error {
		t := &delegationToken{Token: token}
		_, err := s.Insert(t)
		if err != nil {
			return err
		}
		id = t.Id
		m.genLog(ctx, s, time.Now().UnixNano(), "STORETOKEN(%d,%s)", id, logEncode(token))
		return nil
	})
	return id, errno(err)

View on GitHub (pinned to c9a67b23e8)

Solutions

  1. Retry the metadata load on a clean database
  2. Inspect the dump file for duplicate ACL ids that could collapse inserts
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at pkg/meta/sql.go:6017 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of juicedata/juicefs@c9a67b23e8 (2026-09-06). Data as JSON: /api/errors/2f014ed6a2c28078. Report an issue: GitHub.