ipfs/kubo · error
failed to read config: %w
Error message
failed to read config: %w
What it means
KeyAPI(name.go).Publish in AllowDelegated mode reads the node config to find configured delegated IPNS publishers. If repo.Config() fails (config unreadable/corrupt/locked), the error is wrapped with this message.
Source
Thrown at core/coreapi/name.go:53
options, err := caopts.NamePublishOptions(opts...)
if err != nil {
return ipns.Name{}, err
}
span.SetAttributes(
attribute.Bool("allowoffline", options.AllowOffline),
attribute.String("key", options.Key),
attribute.Float64("validtime", options.ValidTime.Seconds()),
)
if options.TTL != nil {
span.SetAttributes(attribute.Float64("ttl", options.TTL.Seconds()))
}
// Handle different publishing modes
if options.AllowDelegated {
// AllowDelegated mode: check if delegated publishers are configured
cfg, err := api.repo.Config()
if err != nil {
return ipns.Name{}, fmt.Errorf("failed to read config: %w", err)
}
delegatedPublishers := cfg.DelegatedPublishersWithAutoConf()
if len(delegatedPublishers) == 0 {
return ipns.Name{}, errors.New("no delegated publishers configured: add Ipns.DelegatedPublishers or use --allow-offline for local-only publishing")
}
// For allow-delegated mode, we only require that we have delegated publishers configured
// The node doesn't need P2P connectivity since we're using HTTP publishing
} else {
// Normal mode: check online status with allow-offline flag
err = api.checkOnline(options.AllowOffline)
if err != nil {
return ipns.Name{}, err
}
}
k, err := keylookup(api.privateKey, api.repo.Keystore(), options.Key)
if err != nil {
return ipns.Name{}, errView on GitHub (pinned to 329838acdf)
Solutions
- Check the wrapped cause (%w) for the underlying read failure and fix it (permissions, JSON syntax).
- Verify IPFS_PATH points at an initialized repo: run `ipfs config show`.
- Restore the config from backup or re-run `ipfs init` in a fresh path if the config is unrecoverable.
Example fix
// before export IPFS_PATH=/wrong/path ipfs name publish --delegated <cid> // after export IPFS_PATH=$HOME/.ipfs ipfs config show >/dev/null && ipfs name publish --delegated <cid>
Defensive patterns
Strategy: try-catch
Validate before calling
if _, err := cfgRoot.Config(); err != nil {
return fmt.Errorf("repo config unreadable, fix before publishing: %w", err)
} Try / catch
n, err := api.Name().Publish(ctx, p, opts.AllowDelegated(true))
var perr *fs.PathError
if errors.As(err, &perr) {
// permission/path problem on the config file; fix IPFS_PATH or permissions
} Prevention
- Verify IPFS_PATH points at an initialized repo.
- Keep config JSON valid; test with `ipfs config show`.
- Run daemons as a user with read access to the repo.
When it happens
Trigger: Publishing with AllowDelegated=true while the repo config cannot be read, e.g. corrupted config file, permission denied, or concurrent repo lock issues.
Common situations: Wrong IPFS_PATH pointing at a directory without a config; config file with invalid JSON; running as a user without read permission on the repo.
Related errors
- no delegated publishers configured: add Ipns.DelegatedPublis
- failed to read config: %w
- no delegated publishers configured: add Ipns.DelegatedPublis
- cannot specify negative resolve cache size
- no key by the given name or PeerID was found
AI-assisted analysis of ipfs/kubo@329838acdf (2026-09-03).
Data as JSON: /api/errors/1e1b7e9ed980870e.
Report an issue: GitHub.