Database Exception On Tag Creation

Topics: Troubleshooting
Jan 21, 2012 at 11:40 PM

Hello, I'm extending Random Pete's Media Garden plugin by pulling in information from a feed and attaching it to his media content. 

However, the program is throwing occasionally throwing an exception when creating tags. I can't reproduce the behavior reliably but it is when calling TagService.UpdateTagsForContentItem

That calls TagService.CreateTag(string tagName) (line 52 in TagService.cs) which then calls Repository.Create

Create throws the exception "could not insert: [Orchard.Core.Common.Models.CommonPartRecord#114][SQL: INSERT INTO Common_CommonPartRecord (OwnerId, CreatedUtc, PublishedUtc, ModifiedUtc, Container_id, Id) VALUES (?, ?, ?, ?, ?, ?)]"

"A duplicate value cannot be inserted into a unique index. [ Table name = Common_CommonPartRecord,Constraint name = PK__Common_CommonPartRecord__0000000000000105 ]"

I'm stumped why it throws errors consistently for some items but not others and since all the code is contained within the TagService I don't think his plugin is interfering in any way. Thoughts?

Jan 22, 2012 at 6:15 AM

Alright I figured it out. The issue wasn't with the tags at all, but another module having an entry that was too long to fit into the database. Adding column.Unlimited to the migration solved the issue.

Jan 23, 2012 at 9:46 AM

Of course, my modules don't have bugs ;)

Seriously though, I'm interested in what you're doing with Media Garden; I planned to add more filters to the modules to process a variety of feeds and extract different types of data, media, playlists, etc. So if you have anything you think might be useful let me know (and of course give me a shout if you need any help figuring out the interfaces, there are quite a lot of undocumented ways to plug into the media pipeline).