{"record":{"id":"d6c43817081bced2","repo":"ipfs/kubo","slug":"syncing-deletes-w","errorCode":null,"errorMessage":"syncing deletes: %w","messagePattern":"syncing deletes: %w","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/node/storage.go","lineNumber":250,"sourceCode":"\t\t}\n\t\tcount++\n\t\tpending++\n\t\tif pending >= purgeBatchSize {\n\t\t\tif err := batch.Commit(ctx); err != nil {\n\t\t\t\treturn count, fmt.Errorf(\"committing delete batch: %w\", err)\n\t\t\t}\n\t\t\tbatch = nil\n\t\t\tpending = 0\n\t\t}\n\t}\n\tif pending > 0 {\n\t\tif err := batch.Commit(ctx); err != nil {\n\t\t\treturn count, fmt.Errorf(\"committing delete batch: %w\", err)\n\t\t}\n\t}\n\tif count > 0 {\n\t\tif err := ds.Sync(ctx, datastore.NewKey(\"/\")); err != nil {\n\t\t\treturn count, fmt.Errorf(\"syncing deletes: %w\", err)\n\t\t}\n\t}\n\treturn count, nil\n}\n\n// isStaleDHTValueRecordKey reports whether key is a pre-v0.42.0 DHT value\n// record: a single root-level path component that base32-decodes to a routing\n// key in one of the DHT value namespaces. Everything else in the datastore\n// (blocks, pins, MFS root, namespaced post-v0.42.0 records, IPNS publisher\n// records, ...) lives under multi-component paths or does not decode to a\n// namespaced routing key, so it never matches.\nfunc isStaleDHTValueRecordKey(key string) bool {\n\tif len(key) < 2 || key[0] != '/' || strings.IndexByte(key[1:], '/') != -1 {\n\t\treturn false\n\t}\n\tdecoded, err := oldDHTValueBase32.DecodeString(key[1:])\n\tif err != nil {\n\t\treturn false","sourceCodeStart":232,"sourceCodeEnd":268,"githubUrl":"https://github.com/ipfs/kubo/blob/329838acdfafae224582930457efe80aa217afc0/core/node/storage.go#L232-L268","documentation":"After deleting stale DHT value records, deleteStaleDHTValueRecords calls ds.Sync(ctx, datastore.NewKey(\"/\")) to flush deletes to stable storage; failure is wrapped as 'syncing deletes'. The deletes may not be durable yet even though the batch committed.","triggerScenarios":"batch.Commit succeeded (count > 0) but the datastore's Sync on the root key fails — typically an fsync/disk I/O error, unsupported Sync on the backing store, or the datastore being closed mid-migration.","commonSituations":"Failing/ro remounted disk during a v0.42 migration, network filesystems where fsync fails, or a custom datastore implementation returning errors from Sync.","solutions":["Inspect the wrapped error for I/O problems (dmesg / disk SMART) and fix underlying storage","Verify the datastore implementation supports Sync; for flatfs/levelds ensure version is current","Re-run the purge after storage recovers; deletes are idempotent","If a custom datastore cannot support Sync semantics, switch to a supported one (flatfs, pebble)"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// verify backing store supports Sync and media is writable\nif _, err := os.Stat(repoPath + \"/datastore\"); err != nil { return err }","typeGuard":null,"tryCatchPattern":"for attempt := 0; attempt < 3; attempt++ {\n    count, err = purgeStaleDHTValueRecords(ctx)\n    if err == nil || !isTransientIO(err) { break }\n    time.Sleep(time.Second * time.Duration(attempt+1))\n}","preventionTips":["Run migrations on healthy local storage, not network mounts prone to fsync failures","Keep flatfs/pebble datastore versions current","Check dmesg/SMART for disk errors after seeing this error"],"tags":["datastore","fsync","migration"],"backgroundTag":"datastore-sync-failure","analyzedSha":"329838acdfafae224582930457efe80aa217afc0","analyzedAt":"2026-09-03T18:30:52.135Z","contentChangedAt":"2026-09-03T18:30:52.135Z","schemaVersion":2},"datasetVersion":"2026-09-11T00:17:11.886Z"}