ipfs/kubo · error
failed to get config value: %q
Error message
failed to get config value: %q
What it means
getConfig calls r.GetConfigKey(key) on the repo; any failure there (key missing, malformed path, IO/read error, permission problem) is wrapped as 'failed to get config value: %q'. It is the read-side counterpart of setConfig and backs `ipfs config <key>`, nodePeerID, replaceConfig, and getRemotePinningServices.
Source
Thrown at core/commands/config.go:563
if !dryRun {
_, err = r.BackupConfig("pre-" + configName + "-")
if err != nil {
return nil, nil, err
}
err = r.SetConfig(newCfg)
if err != nil {
return nil, nil, err
}
}
return oldCfg, newCfg, nil
}
func getConfig(r repo.Repo, key string) (*ConfigField, error) {
value, err := r.GetConfigKey(key)
if err != nil {
return nil, fmt.Errorf("failed to get config value: %q", err)
}
return &ConfigField{
Key: key,
Value: value,
}, nil
}
func getConfigWithAutoExpand(r repo.Repo, key string) (*ConfigField, error) {
// First get the current value
value, err := r.GetConfigKey(key)
if err != nil {
return nil, fmt.Errorf("failed to get config value: %q", err)
}
// Load full config for resolution
fullCfg, err := r.Config()
if err != nil {
return nil, fmt.Errorf("failed to load config: %q", err)View on GitHub (pinned to 329838acdf)
Solutions
- Verify the key exists in `ipfs config show` output; remember dot-paths are case-sensitive
- Check the repo is healthy and readable: `ipfs repo stat`, file permissions on $IPFS_PATH/config
- Run as the user who owns the repo; confirm IPFS_PATH points at the right repo
- If the config file is corrupt, restore it from backup or re-init and `ipfs config replace`
Example fix
// before $ ipfs config Addresses.Nonexistent cd: failed to get config value: "no such key" // after $ ipfs config show | jq '.Addresses' $ ipfs config Addresses.API # use an existing path
Defensive patterns
Strategy: try-catch
Validate before calling
ipfs config "$key" >/dev/null 2>&1 || echo "key missing or repo unreadable"
Type guard
func getConfigString(r repo.Repo, key string) (string, bool) {
f, err := getConfig(r, key)
if err != nil { return "", false }
s, ok := f.Value.(string)
return s, ok
} Try / catch
f, err := getConfig(repo, key)
if err != nil {
if strings.Contains(err.Error(), "failed to get config value") {
// fall back to config defaults or skip this key
}
return err
} Prevention
- Check key paths against `ipfs config show` before reading them in scripts
- Ensure the process user can read $IPFS_PATH/config and IPFS_PATH is set correctly
- Run `ipfs repo stat`/repo fsck when reads start failing after crashes
- Monitor repo health in automation
When it happens
Trigger: `ipfs config <nonexistent.key>`; reading a nested key where an intermediate segment is not a map; offline command when the repo config file is unreadable/corrupt; caller functions setConfig/nodePeerID/replaceConfig/getRemotePinningServices hitting the same read failure.
Common situations: Typos in key paths; expecting a default that is not materialized in the config file; running CLI as wrong user so the config file is unreadable; repo partially initialized or corrupted; remote pinning services lookup against broken config.
Related errors
- failed to find specified key
- reading config from repo (%v)
- could not read config: %w
- invalid configuration profile: %s
- ipfs not initialized, please run 'ipfs init'
AI-assisted analysis of ipfs/kubo@329838acdf (2026-09-03).
Data as JSON: /api/errors/f4ee69f22476e5b3.
Report an issue: GitHub.