{"record":{"id":"ff7e34c072765eb2","repo":"ipfs/kubo","slug":"creating-batch-for-orphaned-keystore-cleanup-w","errorCode":null,"errorMessage":"creating batch for orphaned keystore cleanup: %w","messagePattern":"creating batch for orphaned keystore cleanup: %w","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/node/provider.go","lineNumber":568,"sourceCode":"\t})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"querying orphaned keystore data: %w\", err)\n\t}\n\tdefer results.Close()\n\n\tvar batch datastore.Batch\n\tvar count, pending int\n\tfor result := range results.Next() {\n\t\tif ctx.Err() != nil {\n\t\t\treturn ctx.Err()\n\t\t}\n\t\tif result.Error != nil {\n\t\t\treturn fmt.Errorf(\"iterating orphaned keystore data: %w\", result.Error)\n\t\t}\n\t\tif batch == nil {\n\t\t\tbatch, err = ds.Batch(ctx)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"creating batch for orphaned keystore cleanup: %w\", err)\n\t\t\t}\n\t\t}\n\t\tif err := batch.Delete(ctx, datastore.NewKey(result.Key)); err != nil {\n\t\t\treturn fmt.Errorf(\"batch deleting orphaned key %s: %w\", result.Key, err)\n\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 fmt.Errorf(\"committing orphaned keystore cleanup batch: %w\", err)\n\t\t\t}\n\t\t\tif err := ds.Sync(ctx, syncKey); err != nil {\n\t\t\t\treturn fmt.Errorf(\"syncing orphaned keystore cleanup: %w\", err)\n\t\t\t}\n\t\t\tbatch = nil\n\t\t\tpending = 0\n\t\t}\n\t}","sourceCodeStart":550,"sourceCodeEnd":586,"githubUrl":"https://github.com/ipfs/kubo/blob/329838acdfafae224582930457efe80aa217afc0/core/node/provider.go#L550-L586","documentation":"Fired by purgeOrphanedKeystoreData when requesting a datastore batch (ds.Batch) fails while preparing to delete orphaned keystore entries left behind after keystore datastore migration/reconfiguration. It wraps the datastore error and aborts the cleanup pass before any deletions.","triggerScenarios":"Thrown at core/node/provider.go:568 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Restart the daemon; transient datastore errors (lock contention, I/O hiccup) usually clear","Check datastore health and disk space if it recurs","If the datastore is corrupted, back up the repo and follow recovery steps in docs/datastores.md"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}