Subtext – ‘Item with the same key has already been added’ error fixed (hopefully)

Many people visiting my site (myself included) have stumbled upon this error message:

subtext_error

I took some time yesterday and, since Subtext is an open source project, I looked into the code trying to find what’s causing it, and fixed it. I don’t know Subtext’s architecture all that well, so I may have broken something on the way. My error log shows no exceptions (as compared to quite a few a day before the fix), so either people stopped visiting my site, or I fixed it smile_regular without breaking anything else.

If I’m wrong, and you do find any errors on the site, please leave a comment under this post.

Technorati Tags:

Comments

Tuna Toksoz says:

Does this only exist in your version or does it still exist in latest drop of subtext? If second one, consider providing a patch 🙂

It does exist in the lastest version as well. Right now, my fix only hides symptoms as oposed to fixing the actual problem. I have to go deeper into the code and understand it better. Then I’ll create a patch.
The good news is however, that It’s probably uncommon bug, and it’s probably related to my usage of custom themes. Not sure though, as I didn’t go over the code that deeply yet.

Phil C says:

hey Krzysztof, thanks for posting this. I am running Subtext as well, and get this error FREQUENTLY. Win 2003 SP2.

Phil,

The actual fix was to remove all the custom themes from user.skin.config but the one I’m using.

The error was connected to how Subtext hashes skins, which caused key duplication, hence the error.