{"record":{"id":"661199834d8f8bb2","repo":"juicedata/juicefs","slug":"format-is-not-inserted","errorCode":null,"errorMessage":"format is not inserted","messagePattern":"format is not inserted","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/meta/sql.go","lineNumber":706,"sourceCode":"\t\t\t\treturn err\n\t\t\t}\n\t\t\tif !ok2 {\n\t\t\t\tn.Inode = TrashInode\n\t\t\t\tn.Mode = 0555\n\t\t\t\tif err = mustInsert(s, n); err != nil {\n\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif ok {\n\t\t\t_, err = s.Update(&setting{\"format\", string(data)}, &setting{Name: \"format\"})\n\t\t\treturn err\n\t\t} else {\n\t\t\tvar set = &setting{\"format\", string(data)}\n\t\t\tif n, err := s.Insert(set); err != nil {\n\t\t\t\treturn err\n\t\t\t} else if n == 0 {\n\t\t\t\treturn fmt.Errorf(\"format is not inserted\")\n\t\t\t}\n\t\t}\n\n\t\tn.Inode = RootInode\n\t\tn.Mode = 0777\n\t\tvar cs = []counter{\n\t\t\t{\"nextInode\", 2}, // 1 is root\n\t\t\t{\"nextChunk\", 1},\n\t\t\t{\"nextSession\", 0},\n\t\t\t{\"usedSpace\", 0},\n\t\t\t{\"totalInodes\", 0},\n\t\t\t{\"nextCleanupSlices\", 0},\n\t\t}\n\t\treturn mustInsert(s, n, &cs)\n\t})\n}\n\nfunc (m *dbMeta) cacheACLs(ctx Context) error {","sourceCodeStart":688,"sourceCodeEnd":724,"githubUrl":"https://github.com/juicedata/juicefs/blob/c9a67b23e8e08ec23ec331aa6f1675e2319e921c/pkg/meta/sql.go#L688-L724","documentation":"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.","triggerScenarios":"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.","commonSituations":"Two concurrent juicefs format commands against the same fresh database; misconfigured database proxy; ON DUPLICATE KEY / trigger interference on the setting table.","solutions":["Re-run juicefs format ensuring no other format/mount is running concurrently","Check for triggers or constraints on the setting table that could suppress the insert","Verify the DB driver reports affected rows correctly (use a standard MySQL/Postgres driver)","Wipe and recreate a fresh metadata database if format state is inconsistent"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// Ensure no concurrent format is running, then retry\nfuser /var/lib/jfs/meta.db 2>/dev/null || echo \"no other process\"","typeGuard":null,"tryCatchPattern":"for i := 0; i < 3; i++ {\n    if err := jfsFormat(...); err == nil { break }\n    time.Sleep(time.Second)\n}","preventionTips":["Serialize format operations (one at a time)","Avoid DB proxies/triggers on the setting table","Use standard, maintained DB drivers"],"tags":["database","sql","insert","format","race"],"backgroundTag":"database-write-failed","analyzedSha":"c9a67b23e8e08ec23ec331aa6f1675e2319e921c","analyzedAt":"2026-09-06T17:55:48.476Z","contentChangedAt":"2026-09-06T17:55:48.476Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}