ipfs/kubo · error
failed to read config: %w
Error message
failed to read config: %w
What it means
Returned when `ipfs ipns put --allow-delegated` cannot read the node configuration (nd.Repo.Config() failed) while checking whether delegated publishers are set up. Wraps the underlying repo/config read error.
Source
Thrown at core/commands/name/name.go:454
return err
}
// Parse options
force, _ := req.Options[forceOptionName].(bool)
allowOffline, _ := req.Options[putAllowOfflineOption].(bool)
allowDelegated, _ := req.Options[allowDelegatedOption].(bool)
// Validate flag combinations
if allowOffline && allowDelegated {
return errors.New("cannot use both --allow-offline and --allow-delegated flags")
}
// Handle different publishing modes
if allowDelegated {
// AllowDelegated mode: check if delegated publishers are configured
cfg, err := nd.Repo.Config()
if err != nil {
return fmt.Errorf("failed to read config: %w", err)
}
delegatedPublishers := cfg.DelegatedPublishersWithAutoConf()
if len(delegatedPublishers) == 0 {
return errors.New("no delegated publishers configured: add Ipns.DelegatedPublishers or use --allow-offline for local-only publishing")
}
// For allow-delegated mode, we proceed even if offline
// since we're using HTTP publishing via delegated publishers
}
// Parse the IPNS name argument
nameArg := req.Arguments[0]
if !strings.HasPrefix(nameArg, "/ipns/") {
nameArg = "/ipns/" + nameArg
}
// Extract the name part after /ipns/
namePart := strings.TrimPrefix(nameArg, "/ipns/")
name, err := ipns.NameFromString(namePart)
if err != nil {View on GitHub (pinned to 329838acdf)
Solutions
- Check permissions on $IPFS_PATH/config and that the command runs as the repo owner
- Validate the config JSON: `ipfs config show` and fix syntax errors from manual edits
- Restart the daemon/repo access and retry
Example fix
// before (config unreadable, e.g. owned by root) ipfs ipns put --allow-delegated --key=self record.bin // error: failed to read config: permission denied // after sudo chown $USER:$USER $IPFS_PATH/config ipfs ipns put --allow-delegated --key=self record.bin
Defensive patterns
Strategy: try-catch
Validate before calling
// pre-check config readability
f, err := os.Open(filepath.Join(ipfsPath, "config"))
if err != nil { /* fix permissions first */ } Try / catch
cfg, err := node.Repo.Config()
if err != nil {
return fmt.Errorf("failed to read config: %w", err)
} Prevention
- Run CLI commands as the same user that owns IPFS_PATH
- Validate config JSON after manual edits (ipfs config show)
When it happens
Trigger: `ipfs ipns put --allow-delegated` executed against a node whose repo config cannot be read — corrupted config file, permission denied on the config file, repo lock/unavailable state.
Common situations: Running the command as a different user than the daemon (permission mismatch on IPFS_PATH), malformed JSON in the config after manual edits, or read-only filesystem.
Related errors
- no delegated publishers configured: add Ipns.DelegatedPublis
- failed to read record: %w
- cannot specify negative resolve cache size
- failed to read config: %w
- no delegated publishers configured: add Ipns.DelegatedPublis
AI-assisted analysis of ipfs/kubo@329838acdf (2026-09-03).
Data as JSON: /api/errors/f46bc40b1879adb5.
Report an issue: GitHub.