error: patch failed: src/app.js:12 error: src/app.js: patch does not apply
A patch can't be applied cleanly to the current files.
error: patch failed patch does not applygit apply patch does not applyerror: while searching forerror: patch failed: src/app.js:12 error: src/app.js: patch does not apply Meaning
The target file changed since the patch was made. Use git apply --3way, git am -3 or patch --merge, or regenerate the patch from the current base.
Common causes
- File changed since patch
- Wrong base commit
- Whitespace/line endings differ
⚡ Quick fix
git apply --3way patch.diffgit am -3 *.patch--ignore-whitespace
Detailed fix by platform
Git
git apply --3way --ignore-whitespace fix.patch
How to diagnose
- Base — same?
- EOL — same?
- 3way — used?
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
- Applying: patch failed. When you have resolved this problem, run git am --continue Patch failed at 0001 Fix bug. hint: Use 'git am --show-current-patch' to see the failed patch
- Authentication failed fatal: Authentication failed for 'https://github.com/x/y.git/'
- Azure DevOps: TF401019 / VS403 push rejected remote: TF401027: You need the GenericContribute permission to perform this action.
Most viewed in Git
- Git SSL certificate problem fatal: unable to access 'https://…': SSL certificate problem: unable to get local issuer certificate
- gpg failed to sign error: gpg failed to sign the data — fatal: failed to write commit object
- workflow scope ! [remote rejected] … (refusing to allow a Personal Access Token to create or update workflow `.github/workflows/x.yml` without `workflow` scope)
Other ways to find it
Where this error sits
Origin: Build & delivery. Errors that are often confused with or caused by this one (click to open):
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
💬 What worked for others
No tips yet — did something else fix this for you?
Share what worked for you
Tips are checked by an editor before they appear. Links are removed.
Report a correction or suggest an improvement
Last updated 25 Nov 2026