microsoft/ailab · critical · SettingsPropertyNotFoundException
[ ] can't be empty.
Error message
[{settingKey}] can't be empty. What it means
CheckSetting reads a key from ConfigurationManager.AppSettings (app.config / web.config appSettings) and throws SettingsPropertyNotFoundException if the value is null or empty. JFKFiles initialization requires every listed setting to be present, so any missing configuration entry aborts the program at startup via CheckSettings.
Solutions
- Open the app/web.config deployed next to JfkWebApiSkills.JfkInitializer.exe and add every required appSettings key with a non-empty value
- The message names the exact missing key ([settingKey]); set that specific key first
- Verify the config file is copied to the output directory (Copy to Output Directory = Copy always) and transforms applied on publish
- Align config with the sample app.config shipped in the repo version you are building
Example fix
// before (app.config) <appSettings> <add key="AzureSearchApiKey" value="" /> </appSettings> // after <appSettings> <add key="AzureSearchApiKey" value="YOUR_KEY" /> </appSettings>
Defensive patterns
Strategy: validation
Validate before calling
var keys = new[] { "SettingA", "SettingB" }; // required keys
foreach (var k in keys)
{
if (string.IsNullOrEmpty(ConfigurationManager.AppSettings[k]))
throw new ConfigurationErrorsException($"[{k}] must be set in appSettings before starting");
} Try / catch
try
{
JfkInitializer.CheckSettings();
}
catch (SettingsPropertyNotFoundException ex)
{
Console.Error.WriteLine($"Missing configuration: {ex.Message}. Update app.config appSettings.");
Environment.Exit(2);
} Prevention
- Keep app.config in sync with the sample config for your repo version
- Set config files to 'Copy to Output Directory: Copy always'
- Validate all required appSettings keys at startup with a single checks routine
- Apply config transforms on publish and verify the deployed config
When it happens
Trigger: Running JfkInitializer with an app.config that lacks any required appSettings key, or a key present with an empty value (e.g. <add key="X" value=""/>).
Common situations: Deploying the binary without its config file; copying app.config as App.config with wrong casing so it isn't picked up; new required settings added in a newer version while the old config is reused; Azure deployment missing the config transform.
Related errors
- Direct Line secret not defined.
- A subscription key is required
- BotFrameworkOptions must be configured prior to setting up…
- Invalid image dimensions
- blobClient is null
AI-assisted analysis of microsoft/ailab@89fe2fc620 (2026-09-13).
Data as JSON: /api/errors/47fcc99aed502706.
Report an issue: GitHub.
Appendix: source
Thrown at JFKFiles/JfkWebApiSkills/JfkInitializer/Program.cs:315
private static void CheckSettings()
{
CheckSetting("SearchServiceName");
CheckSetting("SearchServiceApiKey");
CheckSetting("SearchServiceQueryKey");
CheckSetting("BlobStorageAccountConnectionString");
CheckSetting("AzureWebAppSiteName");
CheckSetting("AzureWebAppUsername");
CheckSetting("AzureWebAppPassword");
CheckSetting("AzureFunctionSiteName");
CheckSetting("AzureFunctionHostKey");
}
private static void CheckSetting(string settingKey)
{
var value = ConfigurationManager.AppSettings[settingKey];
if (string.IsNullOrEmpty(value))
{
throw new SettingsPropertyNotFoundException($"[{settingKey}] can't be empty.");
}
}
}
}
View on GitHub (pinned to 89fe2fc620)