{"record":{"id":"0cad65e8bfea7b1d","repo":"ipfs/kubo","slug":"provider-error-flushing-mfs-w","errorCode":null,"errorMessage":"provider: error flushing MFS: %w","messagePattern":"provider: error flushing MFS: %w","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/node/provider.go","lineNumber":1285,"sourceCode":"\t}\n\treturn mfsWalkProvider(mfsRoot, bs, tracker, walk)\n}\n\n// mfsEntityRootsProvider is the +entities counterpart. It walks with\n// WalkEntityRoots, emitting only entity roots and skipping file chunks.\nfunc mfsEntityRootsProvider(mfsRoot *mfs.Root, bs blockstore.Blockstore, tracker walker.VisitedTracker) provider.KeyChanFunc {\n\twalk := func(ctx context.Context, root cid.Cid, emit func(cid.Cid) bool, opts ...walker.Option) error {\n\t\treturn walker.WalkEntityRoots(ctx, root, walker.NodeFetcherFromBlockstore(bs), emit, opts...)\n\t}\n\treturn mfsWalkProvider(mfsRoot, bs, tracker, walk)\n}\n\n// mfsWalkProvider builds a KeyChanFunc that flushes MFS, then walks\n// with the given walkFunc using a shared tracker and locality check.\nfunc mfsWalkProvider(mfsRoot *mfs.Root, bs blockstore.Blockstore, tracker walker.VisitedTracker, walk walkFunc) provider.KeyChanFunc {\n\treturn func(ctx context.Context) (<-chan cid.Cid, error) {\n\t\tif err := mfsRoot.FlushMemFree(ctx); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"provider: error flushing MFS: %w\", err)\n\t\t}\n\t\trootNode, err := mfsRoot.GetDirectory().GetNode()\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"provider: error loading MFS root: %w\", err)\n\t\t}\n\n\t\tch := make(chan cid.Cid)\n\t\tgo func() {\n\t\t\tdefer close(ch)\n\t\t\tlocality := func(ctx context.Context, c cid.Cid) (bool, error) {\n\t\t\t\treturn bs.Has(ctx, c)\n\t\t\t}\n\t\t\t_ = walk(ctx, rootNode.Cid(), func(c cid.Cid) bool {\n\t\t\t\tselect {\n\t\t\t\tcase ch <- c:\n\t\t\t\t\treturn true\n\t\t\t\tcase <-ctx.Done():\n\t\t\t\t\treturn false","sourceCodeStart":1267,"sourceCodeEnd":1303,"githubUrl":"https://github.com/ipfs/kubo/blob/329838acdfafae224582930457efe80aa217afc0/core/node/provider.go#L1267-L1303","documentation":"Returned by mfsWalkProvider (the +unique/+entities MFS provider) when mfsRoot.FlushMemFree(ctx) fails. FlushMemFree flushes MFS writes to the blockstore and frees memory; any datastore write error during that flush aborts the reprovide cycle before the DAG walk starts. The original datastore error is wrapped and preserved.","triggerScenarios":"Reprovide cycle with strategies using mfs (+unique and/or +entities modifiers) when FlushMemFree hits a datastore write error, disk full, or context cancellation during flush.","commonSituations":"Disk full or quota exceeded on the node's datastore, corrupted datastore after unclean shutdown, slow/remote datastore timing out, or daemon shutdown cancelling the context mid-flush.","solutions":["Check the wrapped error in logs: disk-full and I/O errors are the usual cause; free space or fix the disk","Restart the daemon to get a fresh MFS root; the periodic reprovide retries the next cycle","Verify datastore health (e.g. 'ipfs repo stat', badger check/repair utilities)","If context cancellation caused it, ensure the node stays up long enough for the flush to complete"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// ensure datastore is writable and has space before heavy operations\nusage := diskUsage(repoPath)\nif usage.free < minFreeBytes {\n    return fmt.Errorf(\"insufficient free space for MFS flush\")\n}","typeGuard":null,"tryCatchPattern":"if err := mfsRoot.FlushMemFree(ctx); err != nil {\n    if ctx.Err() != nil {\n        return nil, ctx.Err() // cancellation: retry later\n    }\n    return nil, fmt.Errorf(\"provider: error flushing MFS: %w\", err)\n}","preventionTips":["Keep free disk headroom on the datastore volume","Avoid stopping the daemon mid-reprovide","Watch for datastore write errors in logs and fix disk issues early"],"tags":["mfs","provider","datastore","flush","reprovide"],"backgroundTag":"datastore-write-failed","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"}