Skip to content

KafkaUI fails to start when configured with WithExplicitStart() #12516

@mikevanoo

Description

@mikevanoo

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

When configuring KafkaUI with WithExplicitStart(), attempting to start KafkaUI from the Dashboard results in an exception.
Without WithExplicitStart() and everything works fine.

Expected Behavior

KafkaUI start without error.

Steps To Reproduce

var events = builder
    .AddKafka("events")
    .WithKafkaUI(configureContainer =>
    {
        configureContainer.WithExplicitStart();
    });

Exceptions (if any)

fail: Aspire.Hosting.Dcp.DcpExecutor[0]
      Failed to start resource kafka-ui
      System.ArgumentException: An item with the same key has already been added. Key: KAFKA_CLUSTERS_0_NAME
         at System.Collections.Generic.Dictionary`2.TryInsert(TKey key, TValue value, InsertionBehavior behavior)
         at System.Collections.Generic.Dictionary`2.Add(TKey key, TValue value)
         at Aspire.Hosting.KafkaBuilderExtensions.<WithKafkaUI>g__ConfigureKafkaUIContainer|5_0(EnvironmentCallbackContext context, EndpointReference endpoint, Int32 index) in /_/src/Aspire.Hosting.Kafka/KafkaBuilderExtensions.cs:line 143
         at Aspire.Hosting.KafkaBuilderExtensions.<>c__DisplayClass5_1.<WithKafkaUI>b__2(EnvironmentCallbackContext context) in /_/src/Aspire.Hosting.Kafka/KafkaBuilderExtensions.cs:line 122
         at Aspire.Hosting.ApplicationModel.EnvironmentCallbackAnnotation.<>c__DisplayClass3_0.<.ctor>b__0(EnvironmentCallbackContext c) in /_/src/Aspire.Hosting/ApplicationModel/EnvironmentCallbackAnnotation.cs:line 59
         at Aspire.Hosting.ApplicationModel.ResourceExtensions.ProcessEnvironmentVariableValuesAsync(IResource resource, DistributedApplicationExecutionContext executionContext, Action`4 processValue, ILogger logger, String containerHostName, CancellationToken cancellationToken) in /_/src/Aspire.Hosting/ApplicationModel/ResourceExtensions.cs:line 352
         at Aspire.Hosting.Dcp.DcpExecutor.BuildEnvVarsAsync(ILogger resourceLogger, IResource modelResource, CancellationToken cancellationToken) in /_/src/Aspire.Hosting/Dcp/DcpExecutor.cs:line 1974
         at Aspire.Hosting.Dcp.DcpExecutor.CreateContainerAsync(AppResource cr, ILogger resourceLogger, CancellationToken cancellationToken) in /_/src/Aspire.Hosting/Dcp/DcpExecutor.cs:line 1506
         at Aspire.Hosting.Dcp.DcpExecutor.StartResourceAsync(IResourceReference resourceReference, CancellationToken cancellationToken) in /_/src/Aspire.Hosting/Dcp/DcpExecutor.cs:line 1829

.NET Version info

.NET SDK v9.0.306
Aspire v9.5.2

Anything else?

No response

Metadata

Metadata

Assignees

Labels

area-integrationsIssues pertaining to Aspire Integrations packageskafkaIssues related to Kafka integrations

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions