juicedata/juicefs · error

format is not inserted

Error message

format is not inserted

What it means

In doInit, after creating the root node and counters inside a transaction, JuiceFS inserts the serialized format as a 'format' setting row. If s.Insert reports 0 affected rows (insert succeeded per no error but wrote nothing), it raises 'format is not inserted' to prevent an uninitialized volume.

Source

Thrown at pkg/meta/sql.go:706

				return err
			}
			if !ok2 {
				n.Inode = TrashInode
				n.Mode = 0555
				if err = mustInsert(s, n); err != nil {
					return err
				}
			}
		}
		if ok {
			_, err = s.Update(&setting{"format", string(data)}, &setting{Name: "format"})
			return err
		} else {
			var set = &setting{"format", string(data)}
			if n, err := s.Insert(set); err != nil {
				return err
			} else if n == 0 {
				return fmt.Errorf("format is not inserted")
			}
		}

		n.Inode = RootInode
		n.Mode = 0777
		var cs = []counter{
			{"nextInode", 2}, // 1 is root
			{"nextChunk", 1},
			{"nextSession", 0},
			{"usedSpace", 0},
			{"totalInodes", 0},
			{"nextCleanupSlices", 0},
		}
		return mustInsert(s, n, &cs)
	})
}

func (m *dbMeta) cacheACLs(ctx Context) error {

View on GitHub (pinned to c9a67b23e8)

Solutions

  1. Re-run juicefs format ensuring no other format/mount is running concurrently
  2. Check for triggers or constraints on the setting table that could suppress the insert
  3. Verify the DB driver reports affected rows correctly (use a standard MySQL/Postgres driver)
  4. Wipe and recreate a fresh metadata database if format state is inconsistent
Defensive patterns

Strategy: retry

Validate before calling

// Ensure no concurrent format is running, then retry
fuser /var/lib/jfs/meta.db 2>/dev/null || echo "no other process"

Try / catch

for i := 0; i < 3; i++ {
    if err := jfsFormat(...); err == nil { break }
    time.Sleep(time.Second)
}

Prevention

When it happens

Trigger: juicefs format on a fresh SQL volume when the INSERT INTO setting returns 0 rows affected — e.g. race with another format process, trigger/DB constraint silently dropping the row, or driver anomaly.

Common situations: Two concurrent juicefs format commands against the same fresh database; misconfigured database proxy; ON DUPLICATE KEY / trigger interference on the setting table.

Related errors


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