question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

System.ArgumentException: 'An item with the same key has already been added. Key: <my-topic-name>'

See original GitHub issue

Hi, I’m trying to stream messages from multiple topics to a single topic, e.g. “archive”.

But I’m getting this exception.

System.ArgumentException: 'An item with the same key has already been added. Key: <my-topic-name>'

   at System.ThrowHelper.ThrowAddingDuplicateWithKeyArgumentException[T](T key)
   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 Streamiz.Kafka.Net.Processors.Internal.InternalTopologyBuilder.BuildTopology(ISet`1 nodeGroup, TaskId taskId)
   at Streamiz.Kafka.Net.Processors.Internal.InternalTopologyBuilder.BuildTopology(Nullable`1 id)
   at Streamiz.Kafka.Net.KafkaStream..ctor(Topology topology, IStreamConfig configuration, IKafkaSupplier kafkaSupplier)
   at MyCompany.MyApp.MyService.CreateKafkaStream() in <obfuscated>.cs:line NN

Am I doing something unintended? Reading from multiple topics and writing to a single topic.

Thanks!

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

4reactions
igor-toporetcommented, Oct 13, 2022

Sorry, I am away from keyboard. But here’s the essence of the topology.

From topic A depending on the contents of the message I branch into two branches, map the messages differently in each branches and ultimately send to topics B and C. From B map again and send to D. From C also map (differently) and send to D again. So the topic D needs to be a terminal destination for both branches.

But a stream with this topology can’t be instantiated. Maybe, a topology must be a directed acyclic graph (DAG)?

Meantime, I managed to work it around with separate streams/topologies. A to B&C, B to D, C to D.

Thanks for looking into this!

0reactions
igor-toporetcommented, Oct 17, 2022

Thank you for fixing it!

Read more comments on GitHub >

github_iconTop Results From Across the Web

An item with the same key has already been added
An item with the same key has already been added. And the exception details: [ArgumentException: An item with the same key has already...
Read more >
Error "An item with the same key has already been added"
This scenario typically occurs if an operating system image is being used to deploy cluster nodes and that image was not correctly prepared...
Read more >
An item with the same key has already been added c# MVC
So start by looking at the error message: An item with the same key has already been added.
Read more >
An Item With the Same Key Has Already Been Added
An item with the same key has already been added error happens when the model has the same property twice. Click here to...
Read more >
An item with the same key has already been added Error
The error reads: "An item with the same key has already been added." It does not matter if I include the database name...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found