Most beginner data engineering mistakes are not exotic. They are the same handful of failures wearing different clothes: a column changes name, a job runs twice, a date drifts by a day, and a dashboard quietly shows zero. The fix is rarely cleverer code. It is finding the smallest failing case and adding one check so the mistake cannot repeat.
Reproduce it before you touch anything
Grab the smallest input that still fails. Cut the file down to twenty rows, run the transformation, and watch where the values go wrong. If you cannot reproduce the problem on a small input, you do not yet understand it, and any edit you make is a guess.
Keep a note of the exact command and time of the failing run. Half of debugging is knowing which version of the data you were looking at.
The four failures behind most bugs
- Schema drift. An upstream source renames, reorders, or drops a column, and your code silently reads the wrong field. Fix: select columns by name and fail when an expected one is missing.
- Duplicates from re-runs. A job that appends instead of replacing doubles its rows on a retry. Fix: make each run idempotent, usually by deleting and reinserting the same partition or merging on a key.
- Date and timezone boundaries. “Yesterday” means different things to a database in UTC and a person in another zone. Fix: agree on one timezone, store timestamps with it, and filter on explicit boundaries.
- Silent nulls. A missing value becomes zero, an average drops, and the trend reverses. Fix: count nulls as part of every load and decide deliberately whether they are allowed.
Add a check before you add the fix
Write the check that should have caught the problem, confirm it fails, and only then correct the logic. That order matters. Without a failing check you cannot tell a fix from a coincidence, and the same bug returns next month with a different column name.
Two checks earn their effort immediately: expected row count within a sane range, and uniqueness of the primary key.
Write the mistake down
Keep a short file called incidents.md in the project. One line per incident: what broke, how it was noticed, what stopped it recurring. This is not paperwork. It is how you notice that four of your last six problems came from the same source, which points to a design problem rather than bad luck.
Know when to restart
Patch when the flow is clear and one step misbehaves. Restart when you cannot explain, in plain sentences, where each table comes from and when it was last built. No amount of defensive code rescues a pipeline nobody can describe.
Should I just add more error handling?
Rarely. Broad exception handling hides failures. Handle the specific case you have seen, and let everything else stop the run.
How do I stop this happening again?
Make the check part of the job, not part of your memory. Checks that live outside the pipeline get skipped.
Treat every mistake as a missing rule rather than a personal failure. A project with twenty small checks and a short incident list is a mature one, however junior the person who built it.