{"record":{"id":"411655a1071ce0e6","repo":"ipfs/kubo","slug":"failed-to-find-specified-key","errorCode":null,"errorMessage":"failed to find specified key","messagePattern":"failed to find specified key","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/commands/config.go","lineNumber":325,"sourceCode":"\treturn scrubMapInternal(m, key, false)\n}\n\n// Scrubs value and returns no error if missing\nfunc scrubOptionalValue(m map[string]any, key []string) (map[string]any, error) {\n\treturn scrubMapInternal(m, key, true)\n}\n\nfunc scrubEither(u any, key []string, okIfMissing bool) (any, error) {\n\tm, ok := u.(map[string]any)\n\tif ok {\n\t\treturn scrubMapInternal(m, key, okIfMissing)\n\t}\n\treturn scrubValueInternal(m, key, okIfMissing)\n}\n\nfunc scrubValueInternal(v any, key []string, okIfMissing bool) (any, error) {\n\tif v == nil && !okIfMissing {\n\t\treturn nil, errors.New(\"failed to find specified key\")\n\t}\n\treturn nil, nil\n}\n\nfunc scrubMapInternal(m map[string]any, key []string, okIfMissing bool) (map[string]any, error) {\n\tif len(key) == 0 {\n\t\treturn make(map[string]any), nil // delete value\n\t}\n\tn := map[string]any{}\n\tfor k, v := range m {\n\t\tif key[0] == \"*\" || strings.EqualFold(key[0], k) {\n\t\t\tu, err := scrubEither(v, key[1:], okIfMissing)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, err\n\t\t\t}\n\t\t\tif u != nil {\n\t\t\t\tn[k] = u\n\t\t\t}","sourceCodeStart":307,"sourceCodeEnd":343,"githubUrl":"https://github.com/ipfs/kubo/blob/329838acdfafae224582930457efe80aa217afc0/core/commands/config.go#L307-L343","documentation":"`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.","triggerScenarios":"`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.","commonSituations":"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`.","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"],"exampleFix":"// before\n$ ipfs config --unset Experimental.FilBrowser\nfailed to find specified key\n// after\n$ ipfs config show | grep -i experimental || true  # confirm key absent\n$ ipfs config --unset Experimental.Libp2pQuantumTunnel # an existing key","handlingStrategy":"try-catch","validationCode":"ipfs config \"$key\" >/dev/null 2>&1 || echo \"key $key not present; unset unnecessary\"","typeGuard":"func keyExists(m map[string]any, path []string) bool {\n\tvar cur any = m\n\tfor _, k := range path {\n\t\tnext, ok := cur.(map[string]any)\n\t\tif !ok { return false }\n\t\tcur, ok = next[k]\n\t\tif !ok { return false }\n\t}\n\treturn cur != nil\n}","tryCatchPattern":"out, err := run(\"ipfs\", \"config\", \"--unset\", key)\nif err != nil && strings.Contains(err.Error(), \"failed to find specified key\") {\n\t// treat as already-unset success\n\terr = nil\n}","preventionTips":["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"],"tags":["config","cli","unset","key-not-found"],"backgroundTag":"config-key-not-found","analyzedSha":"329838acdfafae224582930457efe80aa217afc0","analyzedAt":"2026-09-03T18:30:52.135Z","contentChangedAt":"2026-09-03T18:30:52.135Z","schemaVersion":2},"datasetVersion":"2026-09-11T00:17:11.886Z"}