Netlify Build Failed: Secrets Scanning Detected Secrets
Quick answer
Netlify can fail a build when a secret value appears in the output or deployed files. Remove the secret from the bundle, or omit specific keys via SECRETS_SCAN_OMIT_KEYS.
Most likely fix: Stop embedding private values
How to fix it
Try these in order — the most common fix is first.
1. Stop embedding private values
- Move secrets to server-side code or Netlify functions
Did this fix it?2. Omit known-safe keys
- Set SECRETS_SCAN_OMIT_KEYS=KEY1,KEY2 in environment variables
- Use SECRETS_SCAN_OMIT_PATHS for files
Did this fix it?3. Check the log
- Read which key and file were flagged and rotate the key if it truly leaked
Did this fix it?
Symptoms
The build fails with a message that secrets scanning found secret values in the build output.
Why it happens
- A private env var gets bundled into client code
- Public keys (such as publishable keys) flagged as secrets
- Env values printed in logs
This guide also covers
- netlify secrets scanning failed build
- netlify exposed secrets detected
Still not working?
If Netlify keeps failing, you're not alone. See every Netlify problem users report or the alternatives people switch to.
Have an app idea? Our small team builds any software: web and mobile apps, games, desktop, AI tools. Price agreed together.
Talk to usThe same problem in other apps
Other Netlify errors
- Netlify Page Not Found on Refresh (SPA 404)
- Netlify Build Failed
- Netlify Deploy Stuck on Building or Enqueued
- Netlify Custom Domain Not Working
- Netlify SSL Certificate Pending or Not Provisioning
- Netlify Function Timeout (502 / 504)
- Netlify Site Paused: Credit Limit Reached
- Netlify Environment Variables Undefined