microsoft/semantic-kernel · error · ArgumentException

The option keys 'store_name' and 'data_sources' are required

Error message

The option keys 'store_name' and 'data_sources' are required for a vector store configuration.

What it means

Thrown while building vector store configurations (CreateVectorStoreConfigurations). Each configuration dictionary must have a non-empty 'store_name' string and a non-null 'data_sources' list. Note store_name uses IsNullOrEmpty (so empty string fails) while data_sources only checks for null (an empty list passes).

Source

Thrown at dotnet/src/Agents/AzureAI/Extensions/AgentToolDefinitionExtensions.cs:164

    internal static IList<VectorStoreConfigurations>? GetVectorStoreConfigurations(this AgentToolDefinition agentToolDefinition)
    {
        var dataSources = agentToolDefinition.GetOption<List<object>?>("configurations");
        return dataSources is not null ? CreateVectorStoreConfigurations(dataSources) : null;
    }

    internal static List<VectorStoreConfigurations> CreateVectorStoreConfigurations(List<object> values)
    {
        List<VectorStoreConfigurations> configurations = [];
        foreach (var value in values)
        {
            if (value is Dictionary<object, object> configurationDict)
            {
                var storeName = configurationDict.TryGetValue("store_name", out var storeNameValue) && storeNameValue is string storeNameString ? storeNameString : null;
                var dataSources = configurationDict.TryGetValue("data_sources", out var dataSourceValue) && dataSourceValue is List<object> dataSourceList ? CreateDataSources(dataSourceList) : null;

                if (string.IsNullOrEmpty(storeName) || dataSources is null)
                {
                    throw new ArgumentException("The option keys 'store_name' and 'data_sources' are required for a vector store configuration.");
                }

                configurations.Add(new VectorStoreConfigurations(storeName, new VectorStoreConfiguration(dataSources)));
            }
        }

        return configurations;
    }

    private static AzureFunctionBinding GetAzureFunctionBinding(this AgentToolDefinition agentToolDefinition, string bindingType)
    {
        Verify.NotNull(agentToolDefinition.Options);

        var binding = agentToolDefinition.GetRequiredOption<Dictionary<object, object>>(bindingType);
        if (!binding.TryGetValue("storage_service_endpoint", out var endpointValue) || endpointValue is not string storageServiceEndpoint)
        {
            throw new ArgumentException($"The option key '{bindingType}.storage_service_endpoint' is required.");
        }

View on GitHub (pinned to c028a0c7dc)

Solutions

  1. Provide a non-empty 'store_name' string.
  2. Provide a 'data_sources' list (can be empty, but the key must exist and be a list).

Example fix

// before
configurations:
  - store_name: ''
    data_sources: []
    # empty store_name -> throws 164

// after
configurations:
  - store_name: 'my-store'
    data_sources: []
Defensive patterns

Strategy: validation

Validate before calling

foreach (var v in values)
{
    if (v is not Dictionary<object, object> d) continue;
    string? store = d.TryGetValue("store_name", out var s) && s is string ss ? ss : null;
    bool hasData = d.TryGetValue("data_sources", out var ds) && ds is List<object>;
    if (string.IsNullOrEmpty(store) || !hasData)
        throw new ArgumentException("Each vector store configuration needs store_name and data_sources.");
}

Type guard

static bool IsValidVectorStoreConfig(Dictionary<object, object> d) =>
    d.TryGetValue("store_name", out var s) && s is string ss && !string.IsNullOrEmpty(ss)
    && d.TryGetValue("data_sources", out var ds) && ds is List<object>;

Prevention

When it happens

Trigger: A vector store configuration entry omits store_name, sets it to empty, or omits the data_sources list / provides it as a non-List<object> value.

Common situations: Malformed configuration block; data_sources key misspelled as 'datasources'; store_name left blank.

Related errors


AI-assisted analysis of microsoft/semantic-kernel@c028a0c7dc (2026-08-13). Data as JSON: /api/errors/b6c5c9000121e89e. Report an issue: GitHub.