{"record":{"id":"e4e0b812ec54dcd6","repo":"commaai/openpilot","slug":"no-reference-series-found-set-an-input-timeseries","errorCode":null,"errorMessage":"No reference series found. Set an input timeseries or return (times, values).","messagePattern":"No reference series found\\. Set an input timeseries or return \\(times, values\\)\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"openpilot/tools/jotpluggler/math_eval.py","lineNumber":124,"sourceCode":"      env[f\"v{i}\"] = series_v[path]\n    else:\n      env[f\"t{i}\"] = reference_time\n      env[f\"v{i}\"] = _resample_to_reference(reference_time, series_t[path], series_v[path])\n\n  with open(globals_path, encoding=\"utf-8\") as f:\n    globals_code = f.read()\n  if globals_code.strip():\n    exec(globals_code, env, env)\n\n  with open(code_path, encoding=\"utf-8\") as f:\n    user_code = f.read()\n  result = _evaluate_user_code(user_code, env)\n\n  if isinstance(result, tuple) and len(result) == 2:\n    result_t, result_v = result\n  else:\n    if first_path is None:\n      raise ValueError(\"No reference series found. Set an input timeseries or return (times, values).\")\n    result_t = series_t[first_path]\n    result_v = result\n\n  result_t = np.asarray(result_t, dtype=np.float64).reshape(-1)\n  result_v = np.asarray(result_v, dtype=np.float64).reshape(-1)\n  if result_t.size == 0 or result_v.size == 0:\n    raise ValueError(\"Custom series returned an empty result\")\n  if result_t.shape != result_v.shape:\n    raise ValueError(f\"Time/value arrays must have the same shape, got {result_t.shape} and {result_v.shape}\")\n\n  _write_vector(out_t_path, result_t)\n  _write_vector(out_v_path, result_v)\n  return 0\n\n\nif __name__ == \"__main__\":\n  try:\n    raise SystemExit(main())","sourceCodeStart":106,"sourceCodeEnd":142,"githubUrl":"https://github.com/commaai/openpilot/blob/516ec1e68203439a73f340f1d0b3b91eabc626ee/openpilot/tools/jotpluggler/math_eval.py#L106-L142","documentation":"After evaluating the user's code, math_eval needs a time axis. If the result is not a (times, values) tuple, it falls back to the times of the first input series (series_t[first_path]). When no input series was supplied (first_path is None), there is no reference timebase and the output cannot be written, so it raises this ValueError.","triggerScenarios":"Running a metric whose code returns a plain value/array while the metric defines no input timeseries; inputs declared but none resolved to actual paths; user intended to return a tuple but returned only the values array.","commonSituations":"Generating a constant or computed-from-scratch series without binding an input; misconfigured metric inputs (wrong keys) so first_path stays None; refactor that dropped the input list.","solutions":["Return a tuple from the code: 'return (times, values)' where times is your own numpy array","Or add an input timeseries to the metric so the fallback reference time exists","Check the metric's input keys resolve to real series (first_path should not be None)"],"exampleFix":"# before\nreturn np.linspace(0, 1, 100) ** 2\n\n# after\ntimes = np.arange(100) / 100.0\nreturn (times, times ** 2)","handlingStrategy":"validation","validationCode":"if not isinstance(result, tuple) and first_path is None:\n    raise SystemExit(\"metric returns a bare value but defines no input series; return (times, values)\")","typeGuard":"def is_timeseries_pair(result) -> bool:\n    \"\"\"True when result is a (times, values) pair of array-likes.\"\"\"\n    return isinstance(result, tuple) and len(result) == 2","tryCatchPattern":"try:\n    result = _evaluate_user_code(user_code, env)\nexcept ValueError as e:\n    if 'No reference series' in str(e):\n        raise SystemExit('add an input timeseries to the metric or return (times, values)')\n    raise","preventionTips":["For metrics with no inputs, always return an explicit (times, values) tuple","Validate metric configs (inputs present OR tuple-returning code) at load time"],"tags":["jotpluggler","math-eval","timeseries","validation","openpilot"],"backgroundTag":null,"analyzedSha":"516ec1e68203439a73f340f1d0b3b91eabc626ee","analyzedAt":"2026-08-15T00:17:37.461Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}