Forum Discussion
Fabric activity(Notebook) failed. 'An item with the same key has already been added.
- 6 months ago
Hello Siva I'm guessing you're using a SPN for the notebook connection. Have you switched to SPN based connection recently? It is quite possible that you're experiencing this problem because the SPN you used in the connection have been used somewhere else.
If there are multiple Connections referencing the same SPN (or duplicate parameter keys/headers in the activity), Fabric can throw 2015 / duplicate key at runtime.If possible, create a new SPN and try again, and let us know how it went!
Hi,
After reviewing the error “An item with the same key has already been added”, this is typically not a notebook runtime issue itself, but a connection configuration conflict in the pipeline activity.
From what I can see, the problem started after the notebook began using a Service Principal–based connection instead of the default Fabric notebook connection. When a custom connection is attached to a Notebook activity, Fabric internally maps connection parameters (headers/keys). If the same key is already defined elsewhere (for example in another connection, linked resource, or implicit default settings), it can trigger this duplicate key exception at runtime.
Here’s what worked for me and why:
✔ The Notebook activity does not require an explicit connection configuration when it runs within the same workspace context.
✔ Removing the custom Service Principal connection from the Notebook activity eliminated the duplicate key registration.
✔ After removing the connection configuration, the pipeline executed successfully.
So the recommended approach is:
Remove the explicit connection from the Notebook activity unless cross-workspace or cross-tenant access is required.
Let the notebook use the default Fabric workspace identity.
Only use a Service Principal connection when accessing external resources that truly require it.
If SPN is required, ensure it is not reused in multiple connections with overlapping parameter definitions.
This appears to be a configuration-level duplication rather than an authentication failure.
Hope this helps others facing the same issue.
Thanks.
- SivaReddy246806 months ago
Advocate I
Thank You for the Information.