A developer says the build passes locally but fails in CI. How do you debug that?
What they are really testing: Whether you have a systematic approach to environment differences instead of guessing. They also want to see whether you treat the CI environment as knowable rather than magical.
A real interview question
A developer says the build passes locally but fails in CI. How do you debug that?
What most people say
drag me
“I would rerun the pipeline and see if it passes.”
It treats the failure as random. Sometimes a rerun does pass, which is worse: it hides a flaky test or a race and trains the team to click retry instead of fixing the cause.
The follow-ups they ask next
It passes on retry roughly half the time. What is your response?
That is a flaky test and it is a defect, not noise. Quarantine it so it stops blocking, then fix the underlying race or ordering dependency. Silent retries destroy trust in the suite.
How do you prevent this class of problem generally?
Run the build inside the same container image everywhere, commit lockfiles and install from them exactly, and keep dev environment setup in code rather than a README.
What the interviewer is listening for
- Reads the error before theorising
- Enumerates differences systematically
- Fixes the class, not the instance
What sinks the answer
- Reaches for retry first
- Treats flaky tests as normal
- No way to reproduce the CI environment
If you genuinely do not know
Say this instead of freezing. Reasoning out loud from what you do know beats silence every single time, and a good interviewer is listening for exactly that.
“First [read the real error, since it may be a genuine bug]. Then check [dependency versions, env vars, case sensitivity, timezone, memory, network]. Reproduce by [running the CI image locally]. Then [pin or containerise so it cannot recur].”
Keep going with troubleshooting
Junior
A production server is failing writes. Disk is 100% full. Walk me through what you do.
Junior
At midnight everything started failing with TLS errors. What happened and what do you do?
Mid
A pod is in CrashLoopBackOff after a deploy. Walk me through your debugging, command by command.
Mid
The deploy reports success, pods are Running, but users get 502s. Where do you look?
Mid
A Kubernetes node goes NotReady and pods are stuck Terminating. What is happening and what do you do?
Mid
You get paged: the site is down. You have no other information. What are your first five minutes?
Knowing the answer is not the same as recalling it under pressure
Sign in to send the questions you fumble to spaced recall, so they come back right before you would forget them, and learn the concepts behind them with hands-on labs.
Start free