Another AI Slop Code Example, Scanned: 14 Findings in 3 Files
One small agent-written change, the exact scan output, and the fixed code, finding by finding.
Lists of AI slop code examples are useful, but each snippet is shown on its own. Real slop arrives as a bundle: one agent change, several patterns, spread across files. This post takes one small change, runs aislop 0.20.0 on it, and goes through every finding with the fix. The full output is real; nothing below is edited except for length.
The change
The task was "add a signup call and a plan helper". The agent produced this, plus a utils file and a stylesheet:
import { useState } from "react";
import { formatDate } from "./utils";
// This function handles the signup form submission
export async function submitSignup(email: string) {
// Send the email to the API
try {
const res = await fetch("https://api.acme-staging.internal/v1/signup", {
method: "POST",
body: JSON.stringify({ email }),
});
const data = (await res.json()) as any;
return data.user;
} catch (error) {
// Ignore errors
}
}
export function getPlan(user: { plan?: string }) {
return user.plan || "pro";
}It type-checks. It returns a user on the happy path. That is usually where review stops.
The scan result
npx -y aislop@0.20.0 scan
59 / 100, Needs Work: 1 error, 13 warnings, 5 fixable. Some findings overlap, because the lint engine (oxlint here) and the AI slop engine both flag the unused imports. Below are the AI slop findings in the order a reviewer should care about them.
1. Swallowed exception (error)
ai-slop/swallowed-exception: "Empty catch block swallows errors silently."
A comment inside the block does not count as handling. When the API is down, the function returns
undefined and the caller shows a success state.
const res = await fetch(url, init);
if (!res.ok) {
throw new Error("Signup failed with status " + res.status);
}Drop the try/catch entirely and let the caller decide what to show. That is the only error in the scan, and it is the one that hurts users.
2. Unsafe type assertion
ai-slop/unsafe-type-assertion: "'as any' bypasses type safety." After the
cast, data.user could be anything and the compiler stops helping.
interface SignupResponse {
user: { id: string; email: string };
}
const data: SignupResponse = await res.json();
return data.user;If the response comes from outside your control, validate it with a schema library instead of declaring the type.
3. Hardcoded environment URL
ai-slop/hardcoded-url: "Hardcoded environment URL in production code." The
host is a staging service, so this works in the demo and fails in production.
import { config } from "./config";
const res = await fetch(new URL("/v1/signup", config.apiBaseUrl), init);4. Narrative and trivial comments
ai-slop/narrative-comment and ai-slop/trivial-comment
flagged "This function handles the signup form submission" and "Send the email to the API". Both restate
the function name and the next line. Delete them. Keep comments for the why that the code cannot say,
such as a rate limit or an upstream bug.
5. Unused imports and a console.log
ai-slop/unused-import found useState and
formatDate, leftovers from an earlier draft. In the hero component,
ai-slop/console-leftover found a console.log
in the render function. All three are marked [auto], so
aislop fix removes them.
6. Unused CSS
ai-slop/unused-css reported .testimonial-card
and .unused-blob: styles for sections the agent generated and later
removed from the markup. Delete the rules, or add an aislop-ignore comment
if a class really is added at runtime.
After aislop fix
npx -y aislop@0.20.0 fix
npx -y aislop@0.20.0 scan
# 67 / 100 Needs Work 1 error · 5 warnings · 0 fixableThe auto-fix pass took the score from 59 to 67 by removing the mechanical findings. The remaining six
(the swallowed exception, the cast, the URL, the two CSS classes and the href="#"
link) are judgement calls, which is why aislop leaves them to you or to your agent via
aislop fix --claude, --cursor or
--codex.
What the scan did not catch
getPlan returns "pro" when the plan is missing.
That quietly upgrades every user with incomplete data, and it was not reported. aislop has an
ai-slop/hidden-fallback rule, but it targets specific shapes (missing counts,
failed diagnostics, impossible states) to keep false positives low, and a plain
|| default is not one of them. Likewise, this example had no long
functions or copy-pasted blocks, so complexity/function-too-long and
code-quality/duplicate-block had nothing to report. A scanner narrows what a
reviewer has to look at; it does not replace the review.
Try it on your own change
npx aislop@latest scan --changes --base origin/mainThat scans only the files your branch changed. For twenty more single patterns, see AI slop code examples. For the website side of this same project, read the code behind a generated landing page. Install options for Bun, pnpm, Homebrew and pip are in bunx aislop scan and --share, and how detection works is in what aislop is. Every rule is listed in the rules reference.
Frequently asked questions
What is an example of AI slop code?
An empty catch block with a comment saying 'Ignore errors', an 'as any' cast on an API response, a comment that restates the next line, an import nobody uses, and a staging URL pasted into source. All five appear in the three-file example in this post.
What does 'another slop code' mean?
People use it for one more piece of low-effort, AI-generated code that compiles but adds noise or hides failures. This post walks through one such example with a real scan.
Which slop findings can be fixed automatically?
In this example aislop fix removed 5 of 14: two unused imports, a console.log, a trivial comment and a narrative comment. The swallowed exception, the as any cast, the hardcoded URL and the unused CSS needed a decision, so they were fixed by hand.
Does aislop catch every kind of slop?
No. It catches patterns that can be defined precisely. In this example a '|| "pro"' default for a missing plan was not reported, so a reviewer still has to check intent.