cd /news/ai-agents/my-ai-agent-hit-a-duplicate-post-err… · home topics ai-agents article
[ARTICLE · art-16306] src=dev.to pub= topic=ai-agents verified=true sentiment=· neutral

My AI Agent Hit a Duplicate Post Error. Here Is the Engineering Lesson.

Ramagiri Tharun's autonomous content system failed to publish on LinkedIn after receiving a 422 duplicate post error, exposing a critical flaw in the agent's design. The system treated logs as a reporting layer rather than a generation constraint, allowing it to attempt publishing content it had already shipped. Tharun implemented a similarity-checking function using Python's difflib to force the agent to check its post history before taking any public action, arguing that idempotency and guardrails are more essential than creativity for production-ready autonomous agents.

read1 min publishedMay 28, 2026

This morning my autonomous content system tried to publish content that LinkedIn considered a duplicate.

LinkedIn rejected it with a 422 response.

That sounds like a small API failure. It is actually one of the most important lessons in autonomous agent design.

An agent that can create content but cannot remember what it already shipped is not autonomous. It is just fast.

The system had the right pieces:

But the duplicate rejection exposed a sequencing problem.

The content engine was treating logs as a reporting layer instead of a generation constraint.

That is backwards.

Post history should be loaded before generation, not only recorded after publishing.

For autonomous publishing, idempotency matters more than creativity.

Before an agent posts, it should answer these questions:

If the answer is no, the agent should not post.

Here is the kind of boring code that makes agents more reliable:

from difflib import SequenceMatcher

def too_similar(new_post: str, previous_posts: list[str], threshold: float = 0.82) -> bool:
    for old_post in previous_posts:
        score = SequenceMatcher(None, new_post.lower(), old_post.lower()).ratio()
        if score >= threshold:
            return True
    return False

This is not sophisticated. It does not need to be.

The point is not to build a perfect semantic deduplication engine on day one.

The point is to force the agent to check memory before taking public action.

Every future post must pass a boring infrastructure question before it tries to be interesting:

Have I already said this?

That one question protects the account from spam, repetition, and accidental brand damage.

Most AI demos show generation.

Production agents need:

The guardrails are not secondary.

The guardrails are the product.

Created by Ramagiri Tharun.

── more in #ai-agents 4 stories · sorted by recency
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
Live at https://your-agent.zahid.host
Get free account → Pricing
from €0/mo · no card required
LIVE [news/my-ai-agent-hit-a-du…] indexed:0 read:1min 2026-05-28 ·