juicedata/juicefs · error
create table delegationToken: %s
Error message
create table delegationToken: %s
What it means
During SQL metadata engine initialization (syncAllTables), JuiceFS creates/verifies all metadata tables via xorm's Sync2. If syncing the delegationToken table fails (DDL error from the database), the error is wrapped with this message and returned, aborting mount/format initialization.
Source
Thrown at pkg/meta/sql.go:607
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"}
var ok bool
err := m.simpleTxn(Background(), func(ses *xorm.Session) (err error) {
ok, err = ses.Get(&s)
return err
})
if err != nil {View on GitHub (pinned to c9a67b23e8)
Solutions
- Grant CREATE, ALTER, INSERT, SELECT, UPDATE, DELETE privileges on the JuiceFS database to the metadata user
- Check the DB server is reachable and not in read-only mode
- Inspect the wrapped underlying error (%s) for the exact DDL failure and fix the table/schema conflict
- Re-run juicefs fsck or mount after fixing privileges; the table sync is idempotent
Example fix
-- before GRANT SELECT, INSERT ON juicefs.* TO 'jfs'@'%'; -- after GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, ALTER ON juicefs.* TO 'jfs'@'%';
Defensive patterns
Strategy: validation
Validate before calling
// Before mounting, verify DDL rights and DB reachability GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, ALTER ON jfs.* TO 'jfs'@'%'; // test: mysql -u jfs -p -e 'CREATE TABLE jfs.__probe(id INT); DROP TABLE jfs.__probe;' jfs
Try / catch
// Wrap mount init and surface the wrapped DDL error
if err := meta.Open(sqlURL); err != nil {
log.Fatalf("metadata init failed (check DB privileges/connectivity): %v", err)
} Prevention
- Grant DDL privileges (CREATE/ALTER) to the metadata user up front
- Test DB connectivity before mounting
- Keep the DB server out of read-only mode
- Take a metadata backup before version upgrades
When it happens
Trigger: juicefs mount or juicefs format against a MySQL/PostgreSQL/SQLite metadata URL when the delegationToken table cannot be created or altered: insufficient DDL privileges, locked schema, unsupported column type migration, or DB connection failure during syncTable.
Common situations: DB user lacks CREATE/ALTER privileges; MySQL server offline mid-startup; migrating an old volume whose schema conflicts; read-only database replica used as metadata URL.
Related errors
- only %d records inserted
- unable to use data source %s: %s
- create table changeLog: %s
- create table setting, counter: %s
- create table edge: %s
AI-assisted analysis of juicedata/juicefs@c9a67b23e8 (2026-09-06).
Data as JSON: /api/errors/17848f8682484154.
Report an issue: GitHub.