juicedata/juicefs · error

create table detachedNode: %s

Error message

create table detachedNode: %s

What it means

syncAllTables (pkg/meta/sql.go:600) creates/auto-migrates the `detachedNode` table via xorm Sync2; failure is wrapped as "create table detachedNode: %s". detachedNode tracks inodes detached from the directory tree (e.g. removed while still open / pending operations). Failure aborts metadata engine initialization.

Source

Thrown at pkg/meta/sql.go:601

		return fmt.Errorf("create table edge: %s", err)
	}
	if err := m.syncTable(new(node), new(symlink), new(xattr)); err != nil {
		return fmt.Errorf("create table node, symlink, xattr: %s", err)
	}
	if err := m.syncTable(new(chunk), new(sliceRef), new(delslices)); err != nil {
		return fmt.Errorf("create table chunk, chunk_ref, delslices: %s", err)
	}
	if err := m.syncTable(new(session2), new(sustained), new(delfile)); err != nil {
		return fmt.Errorf("create table session2, sustaind, delfile: %s", err)
	}
	if err := m.syncTable(new(flock), new(plock), new(dirQuota), new(userGroupQuota)); err != nil {
		return fmt.Errorf("create table flock, plock, dirQuota, userGroupQuota: %s", err)
	}
	if err := m.syncTable(new(dirStats)); err != nil {
		return fmt.Errorf("create table dirStats: %s", err)
	}
	if err := m.syncTable(new(detachedNode)); err != nil {
		return fmt.Errorf("create table detachedNode: %s", err)
	}
	if err := m.syncTable(new(acl)); err != nil {
		return fmt.Errorf("create table acl: %s", err)
	}
	if err := m.syncTable(new(delegationToken)); err != nil {
		return fmt.Errorf("create table delegationToken: %s", err)
	}
	if err := m.syncTable(new(changeLog)); err != nil {
		return fmt.Errorf("create table changeLog: %s", err)
	}
	return nil
}

func (m *dbMeta) doInit(format *Format, force bool) error {
	if err := m.syncAllTables(); err != nil {
		return err
	}
	var s = setting{Name: "format"}

View on GitHub (pinned to c9a67b23e8)

Solutions

  1. Read the wrapped driver error and fix the root cause (grant, space, connectivity).
  2. Ensure the DB user has CREATE privilege — this table is added by newer versions and requires fresh DDL on old volumes.
  3. Retry after transient connection errors; earlier tables already exist and Sync2 skips them.
  4. Verify the database accepts DDL from this host/user (managed-DB restriction lists).
  5. Back up and remove any conflicting table named detachedNode.
Defensive patterns

Strategy: validation

Validate before calling

// Preflight on legacy volumes upgrading to versions that add detachedNode:
//   SHOW GRANTS FOR CURRENT_USER();  -- CREATE must be present
//   SHOW TABLES LIKE 'jfs_detachedNode';  -- absence is expected on first upgrade

Try / catch

if err := initMeta(); err != nil {
    if strings.Contains(err.Error(), "create table detachedNode") {
        return fmt.Errorf("detachedNode DDL failed; new table creation requires CREATE privilege: %w", err)
    }
    return err
}

Prevention

When it happens

Trigger: Metadata engine initialization when Sync2 on detachedNode fails: same class of DDL problems — privileges, storage, connection drop, or conflicting pre-existing table.

Common situations: Newer JuiceFS clients adding this table to an older volume while the DB user lacks CREATE rights; read-only managed database tier; hitting connection limits late in the init sequence.

Related errors


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