AI agents are writing production code now. Not just prototypes—actual projects people depend on. And the bugs? They're revealing something uncomfortable about the state of AI-assisted development. PVS-Studio ran their Go analyzer across a batch of popular agent-based and AI-related projects, looking for exactly what kind of garbage gets shipped when humans step back from the keyboard.
New-API: When If-Else Becomes Meaningless
New-API is an LLM gateway managing API keys from multiple providers with 33,000 GitHub stars. Even this heavily-trafficked project contains head-scratchers. The analyzer flagged code where if common.UsingSQLite || common.UsingPostgreSQL executes identical logic in both branches—making the conditional entirely pointless. A similar pattern appears in StreamResponseClaude2OpenAI where message_stop and the else clause both return nil, suggesting unfinished implementation or copy-paste debris.
Tau: The Type Confusion Epidemic
Tau, an open-source platform for self-hosted cloud infrastructure, shipped with a switch statement using I64Type twice instead of I64Type and F64Type. The second case containing math.Float64frombits() can never execute because it's shadowed by the first identical case. This isn't a subtle logic error—this is the kind of bug that silently corrupts floating-point data until someone notices their cloud costs are slightly wrong for six months.
Sub2API: Redundant Conditions and Duplicate Returns
Sub2API's schema_cleaner.go contains if/else branches with identical assignments, making the condition decorative at best. More concerning is classifyOpsPhase where 'billing_error', 'subscription_error' and 'invalid_request_error' all return the same value but aren't merged—suggesting either inconsistent error handling or missing logic that should differentiate these cases.
PhotoPrism: The Loop That Never Runs
PhotoPrism, a self-hosted photo app with built-in AI capabilities, contains this gem: for k := areas[j].end; k > areas[j].end. The loop condition will never be true because you're starting at the end and checking if it's greater than itself. This is pure typo territory—probably a late-night coding session or an AI that hallucinated a variable name.
Axonhub: Redundant Nil Checks
Axonhub's aggregator.go performs event.Delta.Signature != nil twice in nested conditions, making the second check pointless since it was already verified. Classic redundant validation that bloats code without adding safety—likely generated incrementally and never cleaned up.
LocalAI: Duplicate Everything
LocalAI takes the cake with an EnableTracing condition duplicated twice, meaning config.EnableTracing gets appended to opts redundantly when enabled. The parseXMLWithFormat function has identical then/else branches assigning match[2] in both paths, suggesting a copy-paste error where developers (or agents) forgot to change an index.
Key Takeaways
- Identical if/else branches appear across every project analyzed—this is the hallmark of generated or careless code
- Duplicate case statements and redundant nil checks indicate insufficient review of AI-written Go
- Type confusion bugs slip through silently, corrupting data in ways that are hard to debug
- The projects with 33k+ stars aren't immune—if anything, they're more likely to accumulate this technical debt unnoticed
The Bottom Line
The pattern is clear: AI-generated and vibe-coded Go produces functionally broken code that ships because it looks plausible. These analyzers exist for a reason—run them before your project becomes the next cautionary tale. Your 33k-star gateway deserves better than identical branches masquerading as logic.