{"record":{"id":"f9db59357a9f5d47","repo":"ipfs/kubo","slug":"provider-error-loading-mfs-root-w","errorCode":null,"errorMessage":"provider: error loading MFS root: %w","messagePattern":"provider: error loading MFS root: %w","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/node/provider.go","lineNumber":1289,"sourceCode":"// 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\n\t\t\t\t}\n\t\t\t}, walker.WithVisitedTracker(tracker), walker.WithLocality(locality))\n\t\t}()\n\t\treturn ch, nil","sourceCodeStart":1271,"sourceCodeEnd":1307,"githubUrl":"https://github.com/ipfs/kubo/blob/329838acdfafae224582930457efe80aa217afc0/core/node/provider.go#L1271-L1307","documentation":"Returned by mfsWalkProvider after a successful FlushMemFree, when mfsRoot.GetDirectory().GetNode() fails to load the root directory's IPLD node from the blockstore. This aborts the +unique/+entities MFS reprovide walk. The wrapped error carries the blockstore/datastore-level cause.","triggerScenarios":"Reprovide cycle using '+unique' or '+entities' with the 'mfs' base while the MFS root node read fails: missing/corrupt root block, blockstore I/O error, or datastore returning not-found for the MFS root CID.","commonSituations":"Corrupted blockstore after unclean shutdown, deleted blocks under a misconfigured GC, version-mismatched repo, or disk I/O failure.","solutions":["Read the wrapped error in the daemon log to find the underlying blockstore cause","Run repo integrity checks / 'ipfs repo fsck'; repair or restore the datastore","Restart the daemon and let the next reprovide cycle retry","If MFS root blocks are unrecoverable, recreate MFS ('ipfs files') and re-pin needed content"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"rootNode, err := mfsRoot.GetDirectory().GetNode()\nif err != nil {\n    return fmt.Errorf(\"MFS root unreadable, +unique/+entities MFS reprovide will fail: %w\", err)\n}","typeGuard":"if rootNode == nil || !rootNode.Cid().Defined() {\n    // invalid root node\n}","tryCatchPattern":"_, err := keyChanFunc(ctx)\nif err != nil && strings.Contains(err.Error(), \"provider: error loading MFS root\") {\n    // trigger repo check/repair before retrying\n}","preventionTips":["Run 'ipfs repo verify'/fsck after unclean shutdowns","Do not run GC in ways that remove MFS-referenced blocks","Monitor blockstore 'not found' errors in logs"],"tags":["mfs","provider","blockstore","reprovide","unique"],"backgroundTag":"mfs-root-load-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"}