SSIS job failed - An item with the same key has already been added
Asked Answered
C

4

13

Our SSIS package fails 2 seconds into the run with the following error:

An item with the same key has already been added.; at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource) at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add) at Microsoft.SqlServer.IntegrationServices.Server.ISServerExec.ProjectOperator.StartPackage() at Microsoft.SqlServer.IntegrationServices.Server.ISServerExec.ProjectOperator.PerformOperation() Transact-SQL stored procedure

We deploy our SSIS packages (2016) to our SSISDB on MSSQL: 13.0.4001.0, we also have environment variables in that same folder

The strange thing is that in this project I have 5 packages that run ok (different job) but only 1 fails (it has its’ own job)

  1. I already deleted a recreated the folder/ environment variables/jobs - same result
  2. I made sure I have Different environment variables folder name
  3. We run the job with different users and 2 of them were admins in the DB
  4. We have other servers which have the same config and project (2 QA environments) and they work the same but OK!

Do I need to go directly to MSDB and delete a row? Where?

Appreciate any ideas – thank you all


I found the error and solution 😊

It seems I deployed a package with 2 same named SMTP connection (one as a project connection and the other with same name as a package connection) I deleted the unnecessary (in my case deleted the package one) and deployed the fixed package. Now the job run successfully calling on one only connection.

  1. I was missing the correct error handling from the error itself since it did not direct me to the specific connection
  2. The package failed at runtime on validations – so no error logs to assist
  3. I run the query from [SSISDB].[catalog].[execution_parameter_values] and compared between a successful run to a failed then I noticed the same named connections

Thank you for your comments!

Yoni

Cornew answered 13/3, 2019 at 15:11 Comment(7)
Does this describe anything that you did to the packages? nickyvv.com/2016/01/… – Herculean
"Item with the same key has already been added" is often a duplicate column. In pretty much every programming language I've dealt with. Stack trace points to a sproc. I'd start there. – Brumal
It's likely the column in the db has a unique constraint – Sordello
@Cornew there are no more deployments into MSDB in SSIS 2016. Please isolate to what place or task the issue occurs. I suggest you implement proper logging. – Diadelphous
@Herculean - This is not the case, I can deploy correctly and the package\job worked fine until a week ago, then something changed (don't know what...) and it started to fail. I have the same project in a different env there it works ok. the job failed with no other error except the one I wrote. Can you direct me to the table it is trying to write into? – Cornew
I found the error and solution 😊 Edited my first question with the solution – Cornew
As far as a cause goes, when I had this issue the cause was copying a project connection from one package in the project to another. It didn't display as a duplicate in the connection manager pane nor in the connection manager list. It didn't bite me until deploying. The top level of the solution provided by the OP did get me on track to fixing. SSIS 2019 – Overset
C
12

I found the error and solution 😊

It seems I deployed a package with 2 same named SMTP connection (one as a project connection and the other with same name as a package connection) I deleted the unnecessary (in my case deleted the package one) and deployed the fixed package. Now the job run successfully calling on one only connection.

  1. I was missing the correct error handling from the error itself since it did not direct me to the specific connection
  2. The package failed at runtime on validations – so no error logs to assist
  3. I run the query from [SSISDB].[catalog].[execution_parameter_values] and compared between a successful run to a failed then I noticed the same named connections

Thank you for your comments!

Yoni

Cornew answered 14/3, 2019 at 14:5 Comment(0)
N
1

I faced the same issue when I copied an existing package and changed the tablenames\excel sheet names. Rebuilding the solution or reopening the visual studio solved issue for me

Neutralism answered 16/9, 2021 at 7:45 Comment(0)
T
0

I got the issue because I had converted a package connection manager from package A to a project connection manager, while having a package connection manager with the same name in package B. I accidentily got the connection manager in both packages because I copied some components over.

It was fixed by removing the package connection manager from package B.

Tynan answered 23/11, 2023 at 10:27 Comment(0)
E
0

I had this when I made a lookup to another query that had two columns without a name. When I gave those two columns the needed aliases, the error vanished.

That would mean that:

An item with the same key has already been added.

can hint at two columns with NULL as the column name or with the same column name.

Expedite answered 20/5 at 21:49 Comment(0)

© 2022 - 2024 β€” McMap. All rights reserved.