microsoft/semantic-kernel · error · Exception
Configuration not found, please setup the notebooks first us
Error message
Configuration not found, please setup the notebooks first using notebook 0-AI-settings.pynb
What it means
The Settings.LoadFromFile method in the Semantic Kernel .NET notebooks throws a generic System.Exception when the configuration file at config/settings.json does not exist. This file is generated by running the 0-AI-settings.ipynb setup notebook, which interactively prompts for the AI backend type, model, endpoint, API key, and org ID. The exception message itself contains a typo ("pynb" instead of "ipynb") and uses the base Exception type rather than a more specific exception like FileNotFoundException.
Source
Thrown at dotnet/notebooks/config/Settings.cs:138
if (!useAzureOpenAI && string.IsNullOrWhiteSpace(orgId))
{
orgId = await InteractiveKernel.GetInputAsync("Please enter your OpenAI Organization Id (enter 'NONE' to skip)");
}
WriteSettings(configFile, useAzureOpenAI, model, azureEndpoint, apiKey, orgId);
return orgId;
}
// Load settings from file
public static (bool useAzureOpenAI, string model, string azureEndpoint, string apiKey, string orgId)
LoadFromFile(string configFile = DefaultConfigFile)
{
if (!File.Exists(configFile))
{
Console.WriteLine("Configuration not found: " + configFile);
Console.WriteLine("\nPlease run the Setup Notebook (0-AI-settings.ipynb) to configure your AI backend first.\n");
throw new Exception("Configuration not found, please setup the notebooks first using notebook 0-AI-settings.pynb");
}
try
{
var config = JsonSerializer.Deserialize<Dictionary<string, string>>(File.ReadAllText(configFile));
bool useAzureOpenAI = config[TypeKey] == "azure";
string model = config[ModelKey];
string azureEndpoint = config[EndpointKey];
string apiKey = config[SecretKey];
string orgId = config[OrgKey];
if (orgId == "none") { orgId = ""; }
return (useAzureOpenAI, model, azureEndpoint, apiKey, orgId);
}
catch (Exception e)
{
Console.WriteLine("Something went wrong: " + e.Message);
return (true, "", "", "", "");View on GitHub (pinned to c028a0c7dc)
Solutions
- Run the 0-AI-settings.ipynb notebook first to generate config/settings.json with your backend credentials
- Verify the working directory is the dotnet/notebooks root so the relative path config/settings.json resolves correctly
- Create the file manually: a JSON object with keys "type", "model", "endpoint", "apikey", and "org" (see Settings.cs constants TypeKey through OrgKey)
- Call Settings.LoadFromFile with an explicit absolute configFile path if running from a non-standard directory
Example fix
// before
var config = Settings.LoadFromFile(); // throws if config/settings.json missing
// after — provide explicit path or check first
string configPath = Path.Combine(AppContext.BaseDirectory, "config", "settings.json");
if (!File.Exists(configPath))
throw new FileNotFoundException("Run 0-AI-settings.ipynb to generate settings.", configPath);
var config = Settings.LoadFromFile(configPath); Defensive patterns
Strategy: validation
Validate before calling
string configPath = Path.Combine(AppContext.BaseDirectory, "config", "settings.json");
if (!File.Exists(configPath))
{
Console.Error.WriteLine($"Config file not found at {configPath}. Run 0-AI-settings.ipynb first.");
return;
} Type guard
static bool TryGetSettings(string configFile, out (bool useAzureOpenAI, string model, string endpoint, string apiKey, string orgId) settings)
{
settings = default;
if (!File.Exists(configFile)) return false;
try
{
var config = JsonSerializer.Deserialize<Dictionary<string, string>>(File.ReadAllText(configFile));
if (config == null || !config.ContainsKey("type")) return false;
settings = (config["type"] == "azure", config["model"], config["endpoint"], config["apikey"], config.GetValueOrDefault("org", ""));
return true;
}
catch { return false; }
} Try / catch
try
{
var settings = Settings.LoadFromFile(configPath);
}
catch (Exception ex) when (ex.Message.Contains("Configuration not found"))
{
Console.Error.WriteLine("Run the 0-AI-settings.ipynb notebook to generate config/settings.json.");
return;
} Prevention
- Run 0-AI-settings.ipynb before any other notebook in the dotnet/notebooks directory
- Use an absolute path for configFile instead of the relative default to avoid working-directory issues
- Commit a template settings.json (without secrets) to document the expected key structure
- Validate the settings file exists and is well-formed in a startup cell before calling LoadFromFile
When it happens
Trigger: LoadFromFile() is called (directly or via ReadSettings/AskAzureEndpoint/AskModel/AskApiKey) when config/settings.json is absent. This happens on first run in a fresh notebook environment, after deleting settings, or when the working directory is not the notebooks root so the relative path resolves to a non-existent location.
Common situations: Cloning the repo and jumping straight into a sample notebook without running 0-AI-settings first; running notebooks from the wrong working directory (relative path 'config/settings.json' resolves incorrectly); CI/automated runs where the setup notebook was never executed; the settings file was gitignored and not restored after a clean clone.
Related errors
- AZURE_OPENAI_ENDPOINT is not set.
- AZURE_OPENAI_ENDPOINT is not set.
- AZURE_OPENAI_ENDPOINT is not set.
- AZURE_FOUNDRY_PROJECT_ENDPOINT is not set.
- AZURE_FOUNDRY_PROJECT_ENDPOINT is not set.
AI-assisted analysis of microsoft/semantic-kernel@c028a0c7dc (2026-08-13).
Data as JSON: /api/errors/580716238de30f62.
Report an issue: GitHub.