{"record":{"id":"11dca46cde8eade6","repo":"git-ecosystem/git-credential-manager","slug":"git-configuration-entry-with-the-name-name-was","errorCode":null,"errorMessage":"Git configuration entry with the name '{name}' was not found.","messagePattern":"Git configuration entry with the name '(.+?)' was not found\\.","errorType":"exception","errorClass":"KeyNotFoundException","httpStatus":null,"severity":"error","filePath":"src/Core/GitConfiguration.cs","lineNumber":980,"sourceCode":"        /// <param name=\"cb\">Callback to invoke for each matching configuration entry.</param>\n        public static void Enumerate(this IGitConfiguration config, string section, string property, GitConfigurationEnumerationCallback cb)\n        {\n            Enumerate(config, GitConfigurationLevel.All, section, property, cb);\n        }\n\n        /// <summary>\n        /// Get the value of a configuration entry as a string.\n        /// </summary>\n        /// <exception cref=\"System.Collections.Generic.KeyNotFoundException\">A configuration entry with the specified key was not found.</exception>\n        /// <param name=\"config\">Configuration object.</param>\n        /// <param name=\"level\">Filter to the specific configuration level.</param>\n        /// <param name=\"name\">Configuration entry name.</param>\n        /// <returns>Configuration entry value.</returns>\n        public static string Get(this IGitConfiguration config, GitConfigurationLevel level, string name)\n        {\n            if (!config.TryGet(level, GitConfigurationType.Raw, name, out string value))\n            {\n                throw new KeyNotFoundException($\"Git configuration entry with the name '{name}' was not found.\");\n            }\n\n            return value;\n        }\n\n        /// <summary>\n        /// Get the value of a configuration entry as a string.\n        /// </summary>\n        /// <exception cref=\"System.Collections.Generic.KeyNotFoundException\">A configuration entry with the specified key was not found.</exception>\n        /// <param name=\"config\">Configuration object.</param>\n        /// <param name=\"name\">Configuration entry name.</param>\n        /// <returns>Configuration entry value.</returns>\n        public static string Get(this IGitConfiguration config, string name)\n        {\n            return Get(config, GitConfigurationLevel.All, name);\n        }\n\n        /// <summary>","sourceCodeStart":962,"sourceCodeEnd":998,"githubUrl":"https://github.com/git-ecosystem/git-credential-manager/blob/e8ce762cd04b4100ae637b5fbf39ef9d0a96561e/src/Core/GitConfiguration.cs#L962-L998","documentation":"This extension method Get(IGitConfiguration, GitConfigurationLevel, string) performs a TryGet for a raw configuration entry and, if absent, throws KeyNotFoundException naming the entry. It is the throwing convenience wrapper over TryGet for callers who treat a missing entry as an error rather than an expected state.","triggerScenarios":"Calling the Get extension with a name that has no value at the given configuration level — e.g. `config.Get(GitConfigurationLevel.Global, \"credential.helper\")` when that key was never set at global scope.","commonSituations":"Assuming a setting exists because it is set at a different level (Local vs Global); typos in entry names; expecting multi-valued entries to resolve via Get when only TryGet/GetAll handle them; fresh machines without the expected git config.","solutions":["Use TryGet instead of Get when absence is acceptable, and handle the false return.","Verify the entry exists with `git config --show-origin --get-all <name>` and at the level you query.","Correct the entry name or set the value at the intended level: `git config --global <name> <value>`.","Check whether the value lives at another level and query GitConfigurationLevel.All."],"exampleFix":"// before\nstring helper = config.Get(GitConfigurationLevel.Global, \"credential.helper\"); // throws if unset\n// after\nif (config.TryGet(GitConfigurationLevel.Global, GitConfigurationType.Raw, \"credential.helper\", out string helper))\n{\n    // use helper\n}\nelse\n{\n    helper = null; // or fall back to another level\n}","handlingStrategy":"try-catch","validationCode":"bool exists = config.TryGet(level, GitConfigurationType.Raw, name, out _);\nif (!exists) { /* set a default or prompt the user */ }","typeGuard":null,"tryCatchPattern":"try\n{\n    value = config.Get(level, name);\n}\ncatch (KeyNotFoundException ex) when (ex.Message.Contains($\"'{name}'\"))\n{\n    value = defaultValue; // or surface a friendly 'setting not configured' message\n}","preventionTips":["Prefer TryGet over Get whenever a missing setting is acceptable.","Check `git config --show-origin --get-all <name>` to see which level actually holds the value.","Beware level-scoped lookups: a value at Local is invisible to a Global-level Get.","Ship sensible defaults for required configuration keys."],"tags":["git-config","key-not-found","configuration"],"backgroundTag":"record-not-found","analyzedSha":"e8ce762cd04b4100ae637b5fbf39ef9d0a96561e","analyzedAt":"2026-09-11T17:15:08.753Z","contentChangedAt":"2026-09-11T17:15:08.753Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}