{"record":{"id":"f4ee69f22476e5b3","repo":"ipfs/kubo","slug":"failed-to-get-config-value-q","errorCode":null,"errorMessage":"failed to get config value: %q","messagePattern":"failed to get config value: %q","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/commands/config.go","lineNumber":563,"sourceCode":"\tif !dryRun {\n\t\t_, err = r.BackupConfig(\"pre-\" + configName + \"-\")\n\t\tif err != nil {\n\t\t\treturn nil, nil, err\n\t\t}\n\n\t\terr = r.SetConfig(newCfg)\n\t\tif err != nil {\n\t\t\treturn nil, nil, err\n\t\t}\n\t}\n\n\treturn oldCfg, newCfg, nil\n}\n\nfunc getConfig(r repo.Repo, key string) (*ConfigField, error) {\n\tvalue, err := r.GetConfigKey(key)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to get config value: %q\", err)\n\t}\n\treturn &ConfigField{\n\t\tKey:   key,\n\t\tValue: value,\n\t}, nil\n}\n\nfunc getConfigWithAutoExpand(r repo.Repo, key string) (*ConfigField, error) {\n\t// First get the current value\n\tvalue, err := r.GetConfigKey(key)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to get config value: %q\", err)\n\t}\n\n\t// Load full config for resolution\n\tfullCfg, err := r.Config()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to load config: %q\", err)","sourceCodeStart":545,"sourceCodeEnd":581,"githubUrl":"https://github.com/ipfs/kubo/blob/329838acdfafae224582930457efe80aa217afc0/core/commands/config.go#L545-L581","documentation":"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.","triggerScenarios":"`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.","commonSituations":"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.","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`"],"exampleFix":"// before\n$ ipfs config Addresses.Nonexistent\ncd: failed to get config value: \"no such key\"\n// after\n$ ipfs config show | jq '.Addresses'\n$ ipfs config Addresses.API  # use an existing path","handlingStrategy":"try-catch","validationCode":"ipfs config \"$key\" >/dev/null 2>&1 || echo \"key missing or repo unreadable\"","typeGuard":"func getConfigString(r repo.Repo, key string) (string, bool) {\n\tf, err := getConfig(r, key)\n\tif err != nil { return \"\", false }\n\ts, ok := f.Value.(string)\n\treturn s, ok\n}","tryCatchPattern":"f, err := getConfig(repo, key)\nif err != nil {\n\tif strings.Contains(err.Error(), \"failed to get config value\") {\n\t\t// fall back to config defaults or skip this key\n\t}\n\treturn err\n}","preventionTips":["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"],"tags":["config","cli","key-not-found","repo"],"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"}