November 27, 2026 · 10 min read · Thomas Osayi
GitHub Actions failing after an AI tool changed your code? How to read the log and fix it
GitHub Actions failing after Lovable, Bolt or Cursor edited your code? Read the failing step, fix lockfile drift, Node versions, missing secrets, type errors and tests.
A red X on a commit is one of the most common things I see after someone lets an AI tool loose on a repository. Lovable, Bolt, Cursor or Claude Code made a change, the preview looked fine, the change synced to GitHub, and then the checks failed with an email that says almost nothing. The good news is that the failure is nearly always mechanical, and the log tells you exactly where to look if you know how to read it.
This post walks through how I read a failing GitHub Actions run and the five causes I check first, with the actual error messages so you can match yours. If the same commit also fails on Vercel, read this alongside "Vercel build failed? The most common Next.js deploy errors and fixes", because the root cause is often shared.
How do I find the real error in a failed GitHub Actions run?
Open the run, click the failed job, expand the first step with a red icon, and read upward from the line that says Process completed with exit code 1.
From the commit, the red X links to the checks. Click Details next to the failing one, and you land on the job view. Each step in the workflow file (checkout, setup Node, install, lint, build, test) appears as its own collapsible section. Only one step actually failed. Everything after it was skipped, so ignore those.
Inside the failed step, scroll to the bottom. The last line is almost always Process completed with exit code 1 (or another non-zero number). That line is GitHub telling you the command failed. It is not the cause. The cause is usually 5 to 40 lines above it, where npm, tsc, ESLint, Vite, Next.js or your test runner printed its own error.
- Look for words like error, ERR!, failed, Cannot find module, or a file path with a line number.
- Ignore warnings that appear before the error unless they mention the same file.
- If the log is long, use the search box at the top of the job log and search for error.
Why does npm ci fail when npm install works on my machine?
Because npm ci installs exactly what package-lock.json records and refuses to run if that file does not match package.json, while npm install quietly updates the lockfile for you.
The npm documentation is direct about this: if dependencies in the package lock do not match those in package.json, npm ci will exit with an error. It also never writes to package.json or the lockfile. That strictness is the point. CI should install the exact versions you tested.
The error usually starts with npm ci can only install packages when your package.json and package-lock.json or npm-shrinkwrap.json are in sync. AI tools cause this constantly. The tool adds a dependency to package.json in its editor, but the lockfile in the repository is never regenerated, or two tools touch the project and one uses a different package manager.
The fix:
- Pull the latest code to your machine.
- Run npm install once. This updates package-lock.json to match.
- Commit both files together and push.
Related failures in the same step: ERESOLVE unable to resolve dependency tree means two packages want incompatible versions of a shared peer (often React), and setup-node's cache option can fail with a message that the dependencies lock file is not found if there is no lockfile at all. If you see a pnpm-lock.yaml or bun.lockb next to package-lock.json, pick one package manager, delete the other lockfile, and make the workflow match.
Is the Node version on the runner different from mine?
Often, yes, because a workflow that does not set a Node version uses whatever default the runner image ships with, and that can differ from the version you or the AI tool used.
GitHub's Node.js guide says that if you do not specify a version, GitHub uses the environment's default Node.js version. The recommended setup is the setup-node action with a node-version input, such as 20.x to track the latest release in that major line. Its examples use actions/checkout@v6 and actions/setup-node@v7 at the time of writing.
Symptoms of a version mismatch:
- SyntaxError on modern syntax in a dependency, meaning the runner's Node is older than the package expects.
- npm warn EBADENGINE, meaning a package's engines field asks for a different Node.
- A build tool that refuses to start and names a minimum Node version in its error.
The fix is to pick one version and pin it everywhere. Check what you run locally with node -v, set the same major version in the workflow's setup-node step, and add an engines field to package.json so the mismatch is visible next time. If your hosting provider has its own Node setting (Vercel and Netlify both do), set it to the same major version so CI and production agree.
Why are my secrets empty in the workflow?
A secret that has not been set evaluates to an empty string, and secrets are not passed at all to workflows triggered from a forked repository, so the workflow runs without the value and fails somewhere downstream.
This one is sneaky because the error rarely says "missing secret". Instead you see a build that crashes on undefined, an API returning 401 Unauthorized, or a Supabase or Firebase client complaining about an invalid URL or key. The workflow found nothing, substituted an empty value, and carried on.
What I check:
- Settings, Secrets and variables, Actions in the repository. Is the secret actually there, with the exact name the workflow uses? Names are case sensitive.
- Is it a repository secret or an environment secret? Environment secrets only appear to a job that declares that environment.
- Was the run triggered by a pull request from a fork, or by Dependabot? GitHub's docs say secrets other than GITHUB_TOKEN are not passed to the runner in those cases.
- Is the secret used in an if condition? The docs say secrets cannot be referenced directly in if conditionals. Map it to a job level environment variable first.
AI tools often add a new environment variable to the app code (say, a new STRIPE_SECRET_KEY) without telling you it also has to exist in GitHub and in your host. "Environment variables undefined on Vercel? Every cause and fix" covers the hosting side of the same problem.
Why do type and lint errors only show up in CI?
Because most AI tool previews run a development server that compiles each file quickly without a full type check, while CI runs tsc, ESLint or a production build that checks every file.
A Vite dev server, which is what Lovable and Bolt projects typically use, strips TypeScript types and serves the result. It does not stop on a type error. Many Vite React templates run tsc before vite build in the build script, so the first full type check happens when CI runs npm run build. The same is true for unused imports flagged by a strict ESLint config.
Common messages:
- error TS2322: Type 'string | undefined' is not assignable to type 'string'. The AI added a value that might be missing and passed it to something that requires it.
- error TS2307: Cannot find module '@/components/Thing'. The import path or alias does not resolve, often after a file was renamed.
- Module not found with a file that clearly exists. Linux runners are case sensitive, so Header.tsx and header.tsx are different files there but not on a default macOS setup.
Fix these properly rather than sprinkling any or ts-ignore over them. A type error is often an honest warning that a value can be undefined at runtime, which is the same bug your users will hit.
What if the tests are what is failing?
Then the AI change most likely broke behavior a test was protecting, or the test depends on something the runner does not have, like a network service, a time zone or a seed database.
Read the test output for the test name and the assertion that failed: expected this, received that. Run that single test locally. If it fails locally too, the change broke it, and you need to decide whether the code or the test is wrong. AI tools sometimes "fix" a failing test by changing the expected value to match the new output, which hides the bug instead of fixing it. Check that diff carefully.
If the test passes locally but fails in CI, look for environment differences:
- Tests that call a real API need either a secret in CI or a mock.
- Date and time tests can fail because runners default to UTC.
- Tests that rely on order or shared state can pass alone and fail together.
If the project has no tests at all and the workflow still fails at a test step, the AI may have added a test script that points at nothing. "How to add tests to an AI-generated app, and what to test first" explains which few tests are worth having before launch.
How do I reproduce the CI failure on my own machine?
Run the same commands the workflow runs, in the same order, from a clean install, and you will see the same error in a few minutes.
Open the workflow file in .github/workflows and copy the run lines. For a typical Node project that means deleting node_modules, running npm ci, then npm run lint, npm run build and npm test. Make sure your local Node major version matches the workflow's node-version. If the failure involves secrets, create a local .env with the same names but never commit it.
Here is an illustration, a made-up project rather than a client. A founder's Bolt app for a dog walking service synced to GitHub, and every push failed. The failed step was npm ci, with the in sync error. Bolt had added a date picker library to package.json, but the lockfile was from the week before. Running npm install locally and committing the lockfile fixed install. The next run failed at build with TS2322 in BookingForm.tsx, because the new picker could return null. A three line null check fixed it. Total time was under an hour, and both errors were in the log the whole time.
When should I stop and get help?
Get help when you have fixed the first error and a new, unrelated one appears each time, or when the failure is in a step you do not understand, like a deploy job, a database migration or signing credentials.
A chain of new errors is normal for one or two rounds. Fixing the install error lets the build run for the first time, which reveals the type errors that were always there. But if you are on round five, the AI tool may be making changes that cause new failures faster than you can fix them. At that point, stop asking it for fixes, roll back to the last green commit (the post "How to undo broken AI changes with git (and Lovable or Bolt history)" covers how), and work forward one change at a time.
For pricing context, one failing workflow with a single cause fits my Quick Fix package from $60 with about 2 days of turnaround. A pipeline with several independent problems (lockfile, Node version, type errors and a missing secret) fits Fix Plus Features from $200 over about 5 days. If the app also needs to be finished and launched, that is the Finish and Launch package from $600.
The bottom line
A failing GitHub Actions run after AI changes looks scary, but the log almost always names the problem. Find the first failed step, read just above the exit code line, and match it against the usual suspects: a lockfile out of sync with package.json, a different Node version, a secret that is not set or not passed, type and lint errors that the preview skipped, or a broken test.
Fix the cause rather than the symptom. Regenerate the lockfile instead of deleting it, pin Node instead of hoping, add the secret instead of hardcoding it, and fix the type error instead of silencing it. Once the pipeline is green, keep it green by asking your AI tool to run the same build and test commands before you accept a change.
Questions, answered in one line
Why does my app work in the Lovable or Bolt preview but fail in GitHub Actions?
The preview runs a development server that is forgiving about type errors and unused code, while CI runs a clean install and a production build, often with type checking and lint, on a fresh Linux machine.
Should I just delete package-lock.json to make npm ci pass?
No, regenerate it with npm install on your machine, commit the updated lockfile, and keep npm ci in the workflow so CI installs exactly what you tested.
Why are my secrets empty in a pull request workflow?
GitHub does not pass repository secrets to workflows triggered from a forked repository, except GITHUB_TOKEN, and any secret name that is not set evaluates to an empty string.
Can I turn off the failing check so I can merge?
You can, but the check is usually catching a real problem that will break the production build later, so fix the cause or at least confirm it is harmless before you skip it.
Can Thomas Osayi fix a failing GitHub Actions workflow for me?
Yes, a single failing workflow fits the Quick Fix package from $60 with about 2 days of turnaround, and a red pipeline with several separate causes fits Fix Plus Features from $200.
Sources
- Building and testing Node.js GitHub Docs
- Using secrets in GitHub Actions GitHub Docs
- npm ci npm Docs
Related articles
- Supabase auth redirect URL not working? Fix localhost, preview and production redirects
- Environment variables undefined on Vercel? Every cause and fix
- How to fix a CORS error on a Next.js API route
- Firestore "Missing or insufficient permissions": what triggers it and how to fix it
Fix, finish and launch your AI-built app
Built your app with Lovable, Bolt, v0, Replit or Cursor and got stuck? I fix the bugs, connect auth and payments, clean up the code and deploy it to production.
See the service