ipfs/kubo · error
failed to find specified key
Error message
failed to find specified key
What it means
`ipfs config <key> --unset` (and profile scrubbing) walks the config map along the dot-separated key path; if any level is missing/nil and the key is not allowed to be absent, scrubValueInternal returns 'failed to find specified key'. It means the key you tried to unset or scrub does not exist in the current config.
Source
Thrown at core/commands/config.go:325
return scrubMapInternal(m, key, false)
}
// Scrubs value and returns no error if missing
func scrubOptionalValue(m map[string]any, key []string) (map[string]any, error) {
return scrubMapInternal(m, key, true)
}
func scrubEither(u any, key []string, okIfMissing bool) (any, error) {
m, ok := u.(map[string]any)
if ok {
return scrubMapInternal(m, key, okIfMissing)
}
return scrubValueInternal(m, key, okIfMissing)
}
func scrubValueInternal(v any, key []string, okIfMissing bool) (any, error) {
if v == nil && !okIfMissing {
return nil, errors.New("failed to find specified key")
}
return nil, nil
}
func scrubMapInternal(m map[string]any, key []string, okIfMissing bool) (map[string]any, error) {
if len(key) == 0 {
return make(map[string]any), nil // delete value
}
n := map[string]any{}
for k, v := range m {
if key[0] == "*" || strings.EqualFold(key[0], k) {
u, err := scrubEither(v, key[1:], okIfMissing)
if err != nil {
return nil, err
}
if u != nil {
n[k] = u
}View on GitHub (pinned to 329838acdf)
Solutions
- Check the key exists first: `ipfs config <key>` — if that fails too, nothing to unset; treat as success in scripts
- Fix the key path spelling and case (paths are dot-separated and case-sensitive)
- List current config with `ipfs config show` and unset the exact key you see
- If the key is legitimately absent, ignore the error or pass/allow okIfMissing behavior where applicable
Example fix
// before $ ipfs config --unset Experimental.FilBrowser failed to find specified key // after $ ipfs config show | grep -i experimental || true # confirm key absent $ ipfs config --unset Experimental.Libp2pQuantumTunnel # an existing key
Defensive patterns
Strategy: try-catch
Validate before calling
ipfs config "$key" >/dev/null 2>&1 || echo "key $key not present; unset unnecessary"
Type guard
func keyExists(m map[string]any, path []string) bool {
var cur any = m
for _, k := range path {
next, ok := cur.(map[string]any)
if !ok { return false }
cur, ok = next[k]
if !ok { return false }
}
return cur != nil
} Try / catch
out, err := run("ipfs", "config", "--unset", key)
if err != nil && strings.Contains(err.Error(), "failed to find specified key") {
// treat as already-unset success
err = nil
} Prevention
- Guard unset calls in scripts by checking `ipfs config <key>` first and tolerating absence
- Keep a canonical list of valid Kubo config keys (docs/config.md) for your automation
- Confirm key spelling/case against `ipfs config show` after Kubo upgrades, since keys can move
When it happens
Trigger: `ipfs config --unset <key>` where key (or an intermediate path segment) is not present, e.g. `ipfs config --unset ProfileX.Foo`; scrubEither/scrubValueInternal invoked by profile apply on a config lacking the key being scrubbed.
Common situations: Typo'd config key path; trying to unset a key that was never set or was already removed; after a version change renamed/moved config keys; scripts assuming a default key exists on fresh `ipfs init`.
Related errors
- failed to get config value: %q
- invalid configuration profile: %s
- cannot add default bootstrap peers: AutoConf is disabled (Au
- cannot remove individual bootstrap peers when using 'auto' p
- cannot set Identity.PeerID to a value that does not match th
AI-assisted analysis of ipfs/kubo@329838acdf (2026-09-03).
Data as JSON: /api/errors/411655a1071ce0e6.
Report an issue: GitHub.