{"record":{"id":"6dfb2e29a64f0722","repo":"ipfs/kubo","slug":"servehttpapi-getconfig-failed-s","errorCode":null,"errorMessage":"serveHTTPApi: GetConfig() failed: %s","messagePattern":"serveHTTPApi: GetConfig\\(\\) failed: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/ipfs/kubo/daemon.go","lineNumber":809,"sourceCode":"\t// TODO(cryptix): our fuse currently doesn't follow this pattern for graceful shutdown\n\tvar errs []error\n\tfor err := range merge(apiErrc, gwErrc, gcErrc, p2pGwErrc, pluginErrc, unmountErrc) {\n\t\tif err != nil {\n\t\t\terrs = append(errs, err)\n\t\t}\n\t}\n\tif len(errs) != 0 {\n\t\treturn errors.Join(errs...)\n\t}\n\n\treturn nil\n}\n\n// serveHTTPApi collects options, creates listener, prints status message and starts serving requests.\nfunc serveHTTPApi(req *cmds.Request, cctx *oldcmds.Context) (<-chan error, error) {\n\tcfg, err := cctx.GetConfig()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"serveHTTPApi: GetConfig() failed: %s\", err)\n\t}\n\n\tlisteners, err := sockets.TakeListeners(\"io.ipfs.api\")\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"serveHTTPApi: socket activation failed: %s\", err)\n\t}\n\n\tapiAddrs := make([]string, 0, 2)\n\tapiAddr, _ := req.Options[commands.ApiOption].(string)\n\tif apiAddr == \"\" {\n\t\tapiAddrs = cfg.Addresses.API\n\t} else {\n\t\tapiAddrs = append(apiAddrs, apiAddr)\n\t}\n\n\tlistenerAddrs := make(map[string]bool, len(listeners))\n\tfor _, listener := range listeners {\n\t\tlistenerAddrs[string(listener.Multiaddr().Bytes())] = true","sourceCodeStart":791,"sourceCodeEnd":827,"githubUrl":"https://github.com/ipfs/kubo/blob/329838acdfafae224582930457efe80aa217afc0/cmd/ipfs/kubo/daemon.go#L791-L827","documentation":"serveHTTPApi fails to read the repo configuration (cctx.GetConfig) before opening the RPC API listener. The %s is the underlying config-load error; it means the daemon could not even determine which addresses to serve the API on, typically due to a missing or corrupt config file in IPFS_PATH.","triggerScenarios":"`ipfs daemon` where the repo config is unreadable, malformed JSON, fails schema validation, or the repo is not initialized / locked.","commonSituations":"Corrupted $IPFS_PATH/config after manual edits; running daemon before `ipfs init`; permission errors on the repo directory; config keys of the wrong type.","solutions":["Run `ipfs config show` or inspect $IPFS_PATH/config to find the malformed key and fix the JSON","Ensure the repo is initialized (`ipfs init`) and IPFS_PATH points at the right directory","Check file permissions on the repo and that no schema validation errors appear (`ipfs daemon` output)","Restore the config from backup or re-run `ipfs init` in a fresh path"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// before daemon start\nif _, err := os.Stat(filepath.Join(ipfsPath, \"config\")); err != nil {\n    return fmt.Errorf(\"repo not initialized at %s: run 'ipfs init'\", ipfsPath)\n}\nvar c map[string]any\nif b, err := os.ReadFile(filepath.Join(ipfsPath, \"config\")); err != nil || json.Unmarshal(b, &c) != nil {\n    return fmt.Errorf(\"config unreadable or malformed\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always run `ipfs init` and set IPFS_PATH before daemon start","Validate config JSON after manual edits","Check repo permissions for the daemon's user"],"tags":["ipfs","kubo","config","api","daemon-startup"],"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"}