{"record":{"id":"671fc4c395fc73cf","repo":"docling-project/docling","slug":"metrics-file-does-not-exist-metrics-file","errorCode":null,"errorMessage":"Metrics file does not exist: {metrics_file}","messagePattern":"Metrics file does not exist: (.+?)","errorType":"console","errorClass":"SystemExit","httpStatus":null,"severity":"error","filePath":"perfs/plot_memory_metrics.py","lineNumber":127,"sourceCode":"    return total_pages, loaded_metrics\n\n\ndef main() -> None:\n    args = parse_args()\n    if not args.input_file.is_file():\n        raise SystemExit(f\"Input file does not exist: {args.input_file}\")\n\n    try:\n        import matplotlib.pyplot as plt\n    except ImportError as exc:\n        raise SystemExit(\n            \"Plotting requires matplotlib. Install it in the environment first.\"\n        ) from exc\n\n    loaded_runs = []\n    for label, metrics_file in _resolve_metrics_files(args.input_file):\n        if not metrics_file.is_file():\n            raise SystemExit(f\"Metrics file does not exist: {metrics_file}\")\n        total_pages, loaded_metrics = load_points(metrics_file)\n        if total_pages:\n            loaded_runs.append((label, total_pages, loaded_metrics))\n\n    if not loaded_runs:\n        raise SystemExit(f\"No plotable data found in {args.input_file}\")\n\n    fig, ax = plt.subplots(1, 1, figsize=(12, 6))\n\n    for label, total_pages, loaded_metrics in loaded_runs:\n        point_count = min(\n            [len(total_pages)] + [len(values) for values in loaded_metrics.values()]\n        )\n        x_values = total_pages[:point_count]\n\n        for key in MEMORY_KEYS:\n            series = loaded_metrics[key][:point_count]\n            if all(value != value for value in series):","sourceCodeStart":109,"sourceCodeEnd":145,"githubUrl":"https://github.com/docling-project/docling/blob/61d76f1ff3f8428065465889f7b4577da7df704c/perfs/plot_memory_metrics.py#L109-L145","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Keep (or restore) the .jsonl metrics files next to the summary report, preserving relative paths.","Edit the runs' 'metrics_file' entries to the correct new locations, or move files so each path resolves from the summary's directory.","Re-run the affected benchmark configurations to regenerate the missing metrics files."],"exampleFix":"# before: summary.json moved to ~/reports but metrics left in /tmp/bench\n$ python perfs/plot_memory_metrics.py ~/reports/summary.json\n# SystemExit: Metrics file does not exist: /tmp/bench/metrics_t8.jsonl\n\n# after\n$ cp /tmp/bench/*.jsonl ~/reports/\n$ python perfs/plot_memory_metrics.py ~/reports/summary.json","handlingStrategy":"validation","validationCode":"import json\nfrom pathlib import Path\n\nsummary = Path(args.input_file)\ndata = json.loads(summary.read_text(encoding=\"utf-8\"))\nmissing = [\n    r[\"metrics_file\"]\n    for r in data[\"runs\"]\n    if isinstance(r, dict) and isinstance(r.get(\"metrics_file\"), str)\n    and not (summary.parent / r[\"metrics_file\"] if not Path(r[\"metrics_file\"]).is_absolute() else Path(r[\"metrics_file\"])).is_file()\n]\nif missing:\n    raise SystemExit(f\"missing metrics files: {missing}\")","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Archive summary and .jsonl metrics files together, preserving relative layout.","Update 'metrics_file' entries when relocating results.","Keep benchmark output directories intact until plotting is done."],"tags":["perf-tooling","filesystem","cli","path"],"backgroundTag":null,"analyzedSha":"61d76f1ff3f8428065465889f7b4577da7df704c","analyzedAt":"2026-08-14T23:53:18.727Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}