Tag Filter - (Habtm)

HABTM error 512 duplicate sql in CakePHP 1.2

While trying to submit a $hasAndBelongsToMany (HABTM) related form under cakephp (1.2 rev 6311) I was getting the following SQL Error :-

Warning (512): SQL Error: 1062: Duplicate entry '4-1' for key 1 [CORE/cake/libs/model/datasources/dbo_source.php, line 440]

Filed under: Cakephp  Tags: Habtm
(default) 9 queries took 27 ms
NrQueryErrorAffectedNum. rowsTook (ms)
1DESCRIBE `posts`171712
2DESCRIBE `comments`11112
3DESCRIBE `tags`221
4DESCRIBE `categories`221
5DESCRIBE `posts_tags`222
6DESCRIBE `categories_posts`221
7SELECT Post.* FROM posts Post, posts_tags pt, tags t WHERE t.tag = ('Habtm') AND t.id = pt.tag_id AND pt.post_id = Post.id AND Post.status = 1 ORDER BY Post.created DESC114
8SELECT category, COUNT(*) AS cat_cnt FROM categories_posts c2p INNER JOIN categories Cat ON c2p.category_id = Cat.id GROUP BY category15153
9SELECT tag, COUNT(*) AS tag_cnt FROM posts_tags t2p INNER JOIN tags Tag ON t2p.tag_id = Tag.id GROUP BY tag49491