UrgisoftAI-built apps

AI-built apps ยท November 2026

Fix AI-generated code: seven common problems in code written by ChatGPT, Claude or Cursor, and how to find each

Short answer: code written by an AI usually fails in one of two ways. Either it does not run at all, and the error message names the cause (a package or function that does not exist, a missing setting). Or it runs and looks finished, and the trouble is in what it left out: a secret key in the file, a check that trusts the browser, errors that are hidden, a query that only works with ten rows. The first kind you can see. The second kind you have to search for. Below is a command or a search for each, and the fix.

Where to look first (two minutes)

Four things tell you what kind of problem it is. The commands are for a JavaScript or TypeScript project, which is what most AI tools write for the web:

  1. What changed. git status and git diff show every file the AI touched since your last save point. If it changed files you did not ask about, read those first.
  2. Does it build. npm run build: the first error in the output is the one to fix; the rest often follow from it.
  3. Do the types hold. npx tsc --noEmit checks a TypeScript project without writing any files, and lists every place where the code uses something in a way its types do not allow.
  4. The browser's Console and Network tabs (F12): red lines there are the app telling you what failed and which request it was.

Match the symptom

What you seeProblem
"Cannot find module", "is not a function", "is not exported", or an install that fails1. A package or function that does not exist
It works on your computer and fails once it is on a host2. Settings that only exist on your computer
A key that starts with sk_, a password or a database address is written in a file3. Secret keys in the code
A user can change a price, see another user's records, or open an admin page by typing its address4. The server trusts the browser
A button does nothing, a page stays on "Loading", and no error shows anywhere5. Errors are hidden
Fine with your ten test records, slow or crashing with real data; or a search box that breaks on an apostrophe6. Database queries written for a demo
The AI says "all tests pass" and the app is still broken7. The checks were switched off

The seven problems, and how to find and fix each

  1. A package or function that does not exist. An AI writes the code that is most likely, and sometimes the most likely name is not a real one: a package that was never published, a function from an older or newer version of a library, an option the library does not have. One study generated 576,000 code samples with 16 models and found that, on average, at least 5.2% of the packages named by commercial models, and 21.7% of those named by open-source models, did not exist.
    Find it: npm view the-package-name prints what the registry knows about a package; an error means there is no such package. For a function, open the library's own documentation for the version in your package.json, not the newest one. Fix: replace the invented name with the real one from the documentation. Do not install a package only because the AI named it: look at its page on npmjs.com first (who publishes it, how many downloads, a link to its source). The same study warns that someone can publish a harmful package under a name AIs often invent.
  2. Settings that only exist on your computer. The code reads a key from a .env file that is not on the host, calls http://localhost:3000, or depends on a program you installed by hand.
    Find it: search the project for localhost, 127.0.0.1 and process.env (or import.meta.env). Every name you find must also be set in the host's own settings, spelled the same. Fix: move addresses into settings, add each one on the host, and build again there. Our deploy page lists the six build errors that stop a deploy.
  3. Secret keys in the code. Asked to "make it work", an AI will often paste the key straight into the file, or put it in code that runs in the browser, where every visitor can read it.
    Find it: search for sk_, secret, password, api_key, service_role and postgres://, and run git log -p -S "sk_" to see whether a key was ever saved in the project's history. Fix: if a key has been in a file that was pushed or shared, treat it as known to others. GitHub's own guidance says the first step is to revoke or rotate that secret; deleting the line later does not undo it. Then keep the new key in the host's settings and read it only in code that runs on the server. GitHub's push protection for users, on by default, stops you from pushing a secret it recognises to a public repository; do not click past its warning. Our security page has the browser check.
  4. The server trusts the browser. The page hides the admin button from ordinary users, and the server never checks who is asking. Or the browser sends the price, the user's id or their role, and the server believes it. Anyone can send their own request with different values.
    Find it: for every server route or function, ask two questions. Does it check that the caller is signed in? Does it read the user's id from the signed-in session, or from the request's own data? Fix: the server takes the user from the session, looks prices and roles up in its own database, and refuses anything that does not belong to that user. Hiding a button is for looks; the check lives on the server.
  5. Errors are hidden. AI-written code often wraps things in try and catch blocks that catch the error and do nothing, or print it where nobody looks. The app does not crash; it just quietly does not do the thing.
    Find it: search for catch and read what each one does. An empty block, or one that only has console.log, is a hidden failure. Also look for calls to a server with no check of the answer. Fix: show the user a plain message, keep the real error where you can read it (the host's logs), and let the code stop instead of carrying on with missing data.
  6. Database queries written for a demo. Three patterns to look for: the app loads every row and filters in the browser; it runs one query per item in a list, so 200 items mean 200 queries; and it builds a query by gluing the user's text into it, which lets a visitor change what the query does.
    Find it: open the Network tab on a page with a list and count the requests; then search the code for queries built with + or ${...} around user input. Fix: ask the database for one page at a time (a limit and an offset or cursor), fetch a list's related data in one query, and pass user text as a parameter. OWASP's guidance is exactly that: parameterized queries, which define the query's structure separately from its data values.
  7. The checks were switched off. Told to "fix the errors", an AI can make the error messages go away instead of the errors: it marks a value as any, adds a comment that tells the checker to look away, or rewrites a failing test so it passes.
    Find it: search for @ts-ignore, @ts-nocheck, eslint-disable, as any, .skip( and ignoreBuildErrors, and look in git diff for tests that were changed or deleted in the same step as the fix. Fix: remove each one, run npx tsc --noEmit and the tests again, and fix what they now report. A test that was edited to pass tells you nothing.

Before you ask the AI to fix it again

(1) Save a point you can return to: git add -A and git commit -m "before fix". (2) Give it one problem at a time, with the exact error text copied word for word and the name of the file. (3) Ask for the cause first and the change second. (4) Read git diff before you accept: if it changed files that have nothing to do with the bug, undo and ask again. (5) npm audit checks your packages for known security problems; npm audit fix installs compatible updates. Leave --force alone unless you know what it will change: npm's documentation says it can install versions outside the range your project asked for, and strongly recommends against it when you are not sure.

This is a checklist from engineering practice, not a study: we have not counted how often each problem happens in AI-written code. The figures in problem 1 are from Spracklen and others, "We Have a Package for You! A Comprehensive Analysis of Package Hallucinations by Code Generating LLMs" (arXiv 2406.10279, listed there as to appear at the 2025 USENIX Security Symposium); they are averages across the models it tested, not a measure of any one tool today. What npm view, npm audit and --force do was read in npm's documentation, what noEmit does in TypeScript's, push protection and rotating a pushed secret in GitHub's, and parameterized queries in OWASP's SQL injection cheat sheet, all on November 20, 2026. Urgisoft is not affiliated with OpenAI, Anthropic, Cursor, GitHub or npm.

Other problems

Built with a builder instead of an editor? A blank page after publishing: six causes. Login and Supabase errors: seven causes. Stripe payments not working: seven causes. Six security checks you can run yourself. Deploy to Vercel or Netlify. Base44 bug fixing: seven common problems. Replit app bug fixing: seven common problems. Slow on phones? Our demo shop, measured before and after: 14.5 s to 1.4 s. Not sure which problem you have? A ten-minute check. Convert a Lovable app to iOS: three routes and seven traps.

Want it fixed for you?

When the same bug survives the steps above, it needs a person reading the code. We fix code and apps written with ChatGPT, Claude, Cursor, Lovable, Bolt, Replit and other AI tools, and tell you in plain words what was wrong. Fixed prices on Fiverr: one bug from $40, up to five bugs with the app working live from $150. No fix, no charge. We work through GitHub or as a collaborator you invite; we never ask for your password, and we ask you to replace any key we could see once the work is done.

See the gig on Fiverr