{"record":{"id":"5da9f589d2a1029b","repo":"ipfs/kubo","slug":"failed-to-get-config-w","errorCode":null,"errorMessage":"failed to get config: %w","messagePattern":"failed to get config: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"core/node/core.go","lineNumber":270,"sourceCode":"\t\tdefault:\n\t\t\treturn nil, err\n\t\t}\n\n\t\t// MFS (Mutable File System) provider integration: Only pass the provider\n\t\t// to MFS when the strategy includes \"mfs\". MFS will call StartProviding()\n\t\t// on every DAGService.Add() operation, which is sufficient for the \"mfs\"\n\t\t// strategy - it ensures all MFS content gets announced as it's added or\n\t\t// modified. For non-mfs strategies, we set provider to nil to avoid\n\t\t// unnecessary providing.\n\t\tstrategyFlag := config.MustParseProvideStrategy(strategy)\n\t\tif strategyFlag&config.ProvideStrategyMFS == 0 {\n\t\t\tprov = nil\n\t\t}\n\n\t\t// Get configured settings from Import config\n\t\tcfg, err := repo.Config()\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to get config: %w\", err)\n\t\t}\n\t\tmfsOpts, err := cfg.Import.MFSRootOptions()\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to build MFS options from Import config: %w\", err)\n\t\t}\n\n\t\t// Keep dag here an online (network-backed) DAGService. \"ipfs files cp\n\t\t// /ipfs/<cid> /path\" stores a lazy pointer: only the referenced root is\n\t\t// fetched, and its children are pulled from the network on demand when\n\t\t// the tree is later traversed (\"files ls -l\", or \"stat\"/\"read\" of a\n\t\t// subpath). Do NOT swap in an offline/local-only DAGService to avoid an\n\t\t// under-lock bitswap hang, that turns those lazy lookups into \"block not\n\t\t// found locally\" errors. The GC-vs-MFS wedge that tempts that change\n\t\t// (ipfs/kubo#10842) is fixed on the GC side instead: MFS mutations hold\n\t\t// the pin lock and GC snapshots the MFS root under the GC lock, so live\n\t\t// MFS blocks are never collected out from under an in-flight write.\n\t\troot, err := mfs.NewRoot(ctx, dag, nd, pf, prov, mfsOpts...)\n\t\tif err != nil {","sourceCodeStart":252,"sourceCodeEnd":288,"githubUrl":"https://github.com/ipfs/kubo/blob/329838acdfafae224582930457efe80aa217afc0/core/node/core.go#L252-L288","documentation":"During MFS root setup, Kubo reads the node configuration via repo.Config() to obtain Import-scoped settings. If the config cannot be loaded (file read error, JSON parse error, datastore-backed config failure), the error is wrapped as \"failed to get config\". This is an infrastructure failure, not a validation failure of individual config values.","triggerScenarios":"Daemon startup when `$IPFS_PATH/config` is unreadable (permissions, missing file), contains invalid JSON or is truncated, or the repo's config store returns an I/O error while the Files constructor runs.","commonSituations":"Hand-editing config.json and leaving a syntax error; running the daemon as a different user without read access; crash mid-write leaving a truncated config; migrating IPFS_PATH across machines with wrong ownership.","solutions":["Validate the config file: `ipfs config show | jq .` — fix any JSON syntax errors it reports.","Check permissions/ownership of `$IPFS_PATH/config` and the repo directory for the daemon's user.","Restore config from a backup, or re-create defaults with `ipfs config` commands; keep a copy before hand edits.","Ensure only one process manages the repo (no concurrent daemon/writer) and re-run `ipfs daemon`."],"exampleFix":"// before: hand-edited config.json\n{\"Identity\": {\"PeerID\": \"...\",}  // trailing comma -> parse error\n\n// after\nipfs config show | jq .   # validate; edit via: ipfs config --json Import.XYZ ...","handlingStrategy":"validation","validationCode":"# Validate the config parses before daemon start\nipfs config show | jq -e . > /dev/null && echo \"config OK\" || echo \"config invalid JSON\"","typeGuard":null,"tryCatchPattern":"// Programmatic repo usage\nif cfg, err := repo.Config(); err != nil {\n    return fmt.Errorf(\"cannot read node config at %s: %w (check JSON syntax and file permissions)\", repo.Path(), err)\n}","preventionTips":["Prefer `ipfs config` / `ipfs config --json` commands over hand-editing config.json.","Validate with `ipfs config show | jq .` after every manual edit.","Keep a backup of the config before bulk changes or version migrations.","Verify ownership/permissions when migrating IPFS_PATH between machines or users."],"tags":["config","startup","json","mfs"],"backgroundTag":"config-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"}