{"record":{"id":"6ae1fde3e22bd42c","repo":"ipfs/kubo","slug":"provider-error-loading-mfs-root-cannot-provide-m","errorCode":null,"errorMessage":"provider: error loading MFS root, cannot provide MFS: %w","messagePattern":"provider: error loading MFS root, cannot provide MFS: %w","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/node/provider.go","lineNumber":1209,"sourceCode":"\treturn fx.Options(opts...)\n}\n\n// OfflineProviders groups units managing provide routing records offline\nfunc OfflineProviders() fx.Option {\n\treturn fx.Provide(func() DHTProvider {\n\t\treturn &NoopProvider{}\n\t})\n}\n\nfunc mfsProvider(mfsRoot *mfs.Root, fetcher fetcher.Factory) provider.KeyChanFunc {\n\treturn func(ctx context.Context) (<-chan cid.Cid, error) {\n\t\terr := mfsRoot.FlushMemFree(ctx)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"provider: error flushing MFS, cannot provide 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, cannot provide MFS: %w\", err)\n\t\t}\n\n\t\tkcf := provider.NewDAGProvider(rootNode.Cid(), fetcher)\n\t\treturn kcf(ctx)\n\t}\n}\n\ntype provStrategyIn struct {\n\tfx.In\n\tPinner               pin.Pinner\n\tBlockstore           blockstore.Blockstore\n\tOfflineIPLDFetcher   fetcher.Factory `name:\"offlineIpldFetcher\"`\n\tOfflineUnixFSFetcher fetcher.Factory `name:\"offlineUnixfsFetcher\"`\n\tMFSRoot              *mfs.Root\n\tRepo                 repo.Repo\n}\n\ntype provStrategyOut struct {","sourceCodeStart":1191,"sourceCodeEnd":1227,"githubUrl":"https://github.com/ipfs/kubo/blob/329838acdfafae224582930457efe80aa217afc0/core/node/provider.go#L1191-L1227","documentation":"This error is returned by the MFS-based provider KeyChanFunc (mfsProvider) in kubo's provider wiring. During a reprovide cycle, after FlushMemFree succeeds, it fetches the MFS root directory's underlying IPLD node via mfsRoot.GetDirectory().GetNode(); if that fails (the root node cannot be loaded from the blockstore or the MFS tree is inconsistent), the provider aborts and the MFS contents are not announced to the routing system. The wrapped underlying error identifies the actual datastore/blockstore failure.","triggerScenarios":"Reprovide cycle with Provide.Strategy including 'mfs' while the MFS root node cannot be materialized: blockstore read errors, corrupted MFS root entry, or mfs.Root not properly initialized when GetDirectory().GetNode() is called.","commonSituations":"Corrupted or truncated datastore after a crash, disk I/O errors, running with a repo whose MFS root was written by an incompatible version, or a bug in node construction leaving MFSRoot uninitialized.","solutions":["Inspect the wrapped %w error in daemon logs to identify the underlying blockstore/datastore failure","Run 'ipfs repo fsck' / verify repo integrity and check disk health","Restart the daemon so the MFS root is re-initialized; the next reprovide retries automatically","If the datastore is corrupt, restore from backup or re-add critical content and re-pin"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// before relying on reprovide, verify MFS root is loadable:\nnode, err := mfsRoot.GetDirectory().GetNode()\nif err != nil {\n    log.Fatalf(\"MFS root unavailable, reprovide of MFS will fail: %v\", err)\n}","typeGuard":"if mfsRoot == nil || mfsRoot.GetDirectory() == nil {\n    // MFS root not initialized; skip MFS providing\n}","tryCatchPattern":"_, err := keyChanFunc(ctx)\nif err != nil {\n    var dsErr datastore.ErrNotFound\n    if errors.As(err, &dsErr) {\n        // MFS root block missing: repair repo before next cycle\n    }\n    log.Warnw(\"MFS reprovide skipped\", \"error\", err)\n}","preventionTips":["Monitor daemon logs for blockstore errors during reprovide cycles","Keep adequate disk space and run on healthy storage","Avoid unclean shutdowns; use 'ipfs shutdown'","Run repo integrity checks after crashes"],"tags":["mfs","provider","blockstore","reprovide"],"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"}