Skip to content

Troubleshooting · Module 08

How to diagnose a pipeline problem in order

  1. Which stage? Read the last Running stage line. Ignore the traceback until you know where it happened.
  2. Did it run at all? skipping / is cached / Running stage are three different states.
  3. What is on disk? Check the output files' timestamps before assuming the stage changed them.
  4. What does the lock say? dvc.lock records the hashes the last successful run used.
  5. Reproduce outside DVC. Run python -m raviride_eta.<stage> directly. If it fails there too, it is a code or environment problem, not a pipeline problem.

Failure table

Symptom Likely cause Fix
ERROR: failed to reproduce 'train' Stage code raised Run the stage directly to see the full traceback
Everything reruns each time Volatile dependency, or params.yaml rewritten on each run Inspect deps; hash files before and after
didn't change after a real edit File missing from deps Add it, then dvc repro
is cached but you expected a run Identical inputs to an earlier run Expected; use --force to prove the code path
ModuleNotFoundError inside a stage DVC used a different interpreter Activate the environment in the same shell; check sys.executable
PermissionError writing models/ Stage uses the current directory, not the project root Anchor paths with PROJECT_ROOT
Lock file conflict Two branches reproduced different code Check out merged declarations and dvc repro; commit the new lock
dvc repro returns 255 DVC wraps a stage failure The real exit code is the stage's, usually 1; read the message
Run "succeeds" with old metrics Wrapper ignored the subprocess exit code Use check=True or test returncode
Cache grows without bound Old outputs never pruned dvc gc with care; it deletes anything not referenced by the current workspace or a remote
pre-commit not running Hooks not installed in this clone pre-commit install
Hook modifies files and commit fails Fixer hooks rewrote the files Re-stage and commit again; that is the designed flow

Case 1: "It says up to date but the metric changed"

This is the most damaging failure in the module, because it is silent.

Stage 'featurise' didn't change, skipping
Stage 'train' didn't change, skipping

You edited features.py five minutes ago. Diagnose:

git status                       # is the file actually saved?
Select-String -Path dvc.yaml -Pattern "features.py"   # is it declared?
dvc status                       # what does DVC think is stale?

If features.py is absent from the train stage's deps, DVC has no reason to care. Add it and rerun. If it is present but the stage still skips, check that you edited the file the stage imports — a second copy of the module elsewhere on sys.path is a classic cause.

Case 2: everything reruns, every time

Something in deps changes on every run. Common culprits: a log file written by the stage itself, a timestamp inside a dependency, params.yaml regenerated by a script with a fresh comment header.

dvc status -c        # shows what changed, with hashes

Remove the volatile file from deps; if the stage genuinely depends on it, make its content deterministic.

Case 3: a stage fails only inside DVC

RuntimeError: column traffic_index missing
ERROR: failed to reproduce 'evaluate'

Run it directly:

python -m raviride_eta.evaluate
  • Fails identically → the code is wrong; fix it.
  • Works directly → environment or working directory differs. Print sys.executable and Path.cwd() at the top of main() and compare with what DVC used.

Case 4: the wrapper reports success on failure

result = subprocess.run(command, cwd=ROOT, capture_output=True, text=True)
print(result.stdout)          # no check, no return code
return 0                      # always "success"

Fix: propagate. If you need a summary, build it from result.returncode, not from the presence of output.

Case 5: hooks block a legitimate commit

big_dump.csv (6145 KB) exceeds 5000 KB.

Ask which is wrong: the file or the limit. A 6 MB fixture that tests need belongs in DVC or an object store, not Git. If the limit is wrong for this repository, change --maxkb deliberately and say why in the commit message.

Never use git commit --no-verify as a habit. If you must bypass, run the hooks manually afterwards and record that you did.

Case 6: interrupted run

Ctrl+C during train leaves no lock update for that stage, so the next dvc repro reruns it. Earlier stages are untouched. Verify:

dvc status
python -m raviride_eta.train      # confirm the stage itself is healthy
dvc repro

If the interruption left a partially written output that DVC considers current (rare, but possible with a killed process after the rename), dvc checkout --force restores the cached version.

When to stop debugging the pipeline

If two stages disagree about the same input, stop and fix the declaration rather than adding retries. Retries hide nondeterminism; declarations expose it. The pipeline is the place where ambiguity becomes visible, which is the service it provides.