docling-project/docling · error · SystemExit

Metrics file does not exist: {metrics_file}

Error message

Metrics file does not exist: {metrics_file}

What it means

SystemExit raised by main() in perfs/plot_memory_metrics.py when a metrics file referenced by the summary report cannot be found on disk. After _resolve_metrics_files() extracts 'metrics_file' paths from the runs array (resolving relative paths against the summary's parent directory), each is checked with Path.is_file() before loading.

Source

Thrown at perfs/plot_memory_metrics.py:127

    return total_pages, loaded_metrics


def main() -> None:
    args = parse_args()
    if not args.input_file.is_file():
        raise SystemExit(f"Input file does not exist: {args.input_file}")

    try:
        import matplotlib.pyplot as plt
    except ImportError as exc:
        raise SystemExit(
            "Plotting requires matplotlib. Install it in the environment first."
        ) from exc

    loaded_runs = []
    for label, metrics_file in _resolve_metrics_files(args.input_file):
        if not metrics_file.is_file():
            raise SystemExit(f"Metrics file does not exist: {metrics_file}")
        total_pages, loaded_metrics = load_points(metrics_file)
        if total_pages:
            loaded_runs.append((label, total_pages, loaded_metrics))

    if not loaded_runs:
        raise SystemExit(f"No plotable data found in {args.input_file}")

    fig, ax = plt.subplots(1, 1, figsize=(12, 6))

    for label, total_pages, loaded_metrics in loaded_runs:
        point_count = min(
            [len(total_pages)] + [len(values) for values in loaded_metrics.values()]
        )
        x_values = total_pages[:point_count]

        for key in MEMORY_KEYS:
            series = loaded_metrics[key][:point_count]
            if all(value != value for value in series):

View on GitHub (pinned to 61d76f1ff3)

Solutions

  1. Keep (or restore) the .jsonl metrics files next to the summary report, preserving relative paths.
  2. Edit the runs' 'metrics_file' entries to the correct new locations, or move files so each path resolves from the summary's directory.
  3. Re-run the affected benchmark configurations to regenerate the missing metrics files.

Example fix

# before: summary.json moved to ~/reports but metrics left in /tmp/bench
$ python perfs/plot_memory_metrics.py ~/reports/summary.json
# SystemExit: Metrics file does not exist: /tmp/bench/metrics_t8.jsonl

# after
$ cp /tmp/bench/*.jsonl ~/reports/
$ python perfs/plot_memory_metrics.py ~/reports/summary.json
Defensive patterns

Strategy: validation

Validate before calling

import json
from pathlib import Path

summary = Path(args.input_file)
data = json.loads(summary.read_text(encoding="utf-8"))
missing = [
    r["metrics_file"]
    for r in data["runs"]
    if isinstance(r, dict) and isinstance(r.get("metrics_file"), str)
    and not (summary.parent / r["metrics_file"] if not Path(r["metrics_file"]).is_absolute() else Path(r["metrics_file"])).is_file()
]
if missing:
    raise SystemExit(f"missing metrics files: {missing}")

Prevention

When it happens

Trigger: A summary whose runs point at metrics files that were deleted, moved, or never transferred; relative 'metrics_file' entries evaluated from a directory that no longer contains them (e.g. summary copied elsewhere without the .jsonl files).

Common situations: Archiving only the summary JSON from a benchmark run and omitting the .jsonl metrics files; cache/tmp cleanup deleting metrics artifacts; reorganizing a results directory so summary and metrics files are separated.

Related errors


AI-assisted analysis of docling-project/docling@61d76f1ff3 (2026-08-14). Data as JSON: /api/errors/671fc4c395fc73cf. Report an issue: GitHub.