ipfs/kubo · error
serveHTTPApi: GetConfig() failed: %s
Error message
serveHTTPApi: GetConfig() failed: %s
What it means
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.
Source
Thrown at cmd/ipfs/kubo/daemon.go:809
// TODO(cryptix): our fuse currently doesn't follow this pattern for graceful shutdown
var errs []error
for err := range merge(apiErrc, gwErrc, gcErrc, p2pGwErrc, pluginErrc, unmountErrc) {
if err != nil {
errs = append(errs, err)
}
}
if len(errs) != 0 {
return errors.Join(errs...)
}
return nil
}
// serveHTTPApi collects options, creates listener, prints status message and starts serving requests.
func serveHTTPApi(req *cmds.Request, cctx *oldcmds.Context) (<-chan error, error) {
cfg, err := cctx.GetConfig()
if err != nil {
return nil, fmt.Errorf("serveHTTPApi: GetConfig() failed: %s", err)
}
listeners, err := sockets.TakeListeners("io.ipfs.api")
if err != nil {
return nil, fmt.Errorf("serveHTTPApi: socket activation failed: %s", err)
}
apiAddrs := make([]string, 0, 2)
apiAddr, _ := req.Options[commands.ApiOption].(string)
if apiAddr == "" {
apiAddrs = cfg.Addresses.API
} else {
apiAddrs = append(apiAddrs, apiAddr)
}
listenerAddrs := make(map[string]bool, len(listeners))
for _, listener := range listeners {
listenerAddrs[string(listener.Multiaddr().Bytes())] = trueView on GitHub (pinned to 329838acdf)
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
Defensive patterns
Strategy: validation
Validate before calling
// before daemon start
if _, err := os.Stat(filepath.Join(ipfsPath, "config")); err != nil {
return fmt.Errorf("repo not initialized at %s: run 'ipfs init'", ipfsPath)
}
var c map[string]any
if b, err := os.ReadFile(filepath.Join(ipfsPath, "config")); err != nil || json.Unmarshal(b, &c) != nil {
return fmt.Errorf("config unreadable or malformed")
} Prevention
- 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
When it happens
Trigger: `ipfs daemon` where the repo config is unreadable, malformed JSON, fails schema validation, or the repo is not initialized / locked.
Common situations: Corrupted $IPFS_PATH/config after manual edits; running daemon before `ipfs init`; permission errors on the repo directory; config keys of the wrong type.
Related errors
- serveHTTPApi: invalid API address: %q (err: %s)
- private networking (swarm.key / LIBP2P_FORCE_PNET) does not
- Routing.AcceleratedDHTClient option is set even tho Routing.
- serveHTTPApi: socket activation failed: %s
- serveHTTPApi: manet.Listen(%s) failed: %s
AI-assisted analysis of ipfs/kubo@329838acdf (2026-09-03).
Data as JSON: /api/errors/6dfb2e29a64f0722.
Report an issue: GitHub.