influxdata/influxdb · error · anyhow::Error

error converting the schedule time

Error message

error converting the schedule time {schedule_time} to Python time: likely python build or libpython issue

What it means

Thrown by execute_schedule_trigger when converting a chrono DateTime (the schedule fire time) to a Python datetime via PyDateTime::from_timestamp fails. This indicates the linked libpython build cannot construct datetime objects (e.g. datetime module not importable in the embedded interpreter), which the code flags as a Python build/libpython problem.

Solutions

  1. Verify the Python environment influxdb3 links against can do `import datetime; datetime.datetime.fromtimestamp(0)` — if it fails, reinstall a full Python (not python3-minimal).
  2. Point PYTHONHOME/PYTHONPATH at a complete Python installation and restart the server.
  3. If using a custom build, rebuild libpython with the datetime C extension enabled (`make` full build, ensure _datetime module is present in lib-dynload).
  4. Check the schedule_time value is a sane Unix timestamp within Python datetime's supported range (year 1–9999).
Defensive patterns

Strategy: try-catch

Validate before calling

// sanity-check the embedded Python's datetime support at startup
import subprocess, sys
r = subprocess.run([sys.executable, "-c",
  "import datetime; datetime.datetime.fromtimestamp(0)"], capture_output=True)
if r.returncode != 0:
    raise SystemExit("Embedded Python datetime module is broken; reinstall full Python")

Try / catch

try {
  triggerSchedule(scheduleTime, args);
} catch (e) {
  if (String(e.message).includes("converting the schedule time")) {
    console.error("libpython/datetime broken — verify full Python install and PYTHONHOME");
  } else throw e;
}

Prevention

When it happens

Trigger: execute_schedule_once → execute_schedule_trigger with a valid schedule_time, but PyDateTime::from_timestamp raises because the embedded Python's datetime module is unavailable/broken (mis-built libpython, stripped stdlib, or timestamp outside datetime representable range).

Common situations: Custom/conda/pyenv Python builds where libpython was linked but the stdlib `datetime` C module is missing; running with a Python installation missing _datetime; system Python stripped by a minimal container image (e.g. python3-minimal); extreme timestamp values far outside year 1–9999.

Understand the failure class

Background: "unsupported platform" / "not supported on this platform" errors: what they mean and how to fix them — this error's family across 47 libraries.

Related errors


AI-assisted analysis of influxdata/influxdb@06200ef96b (2026-09-19). Data as JSON: /api/errors/9f325adb7bbafb03. Report an issue: GitHub.

Appendix: source

Thrown at influxdb3_py_api/src/system_py.rs:498

    let write_accumulator: Arc<WriteAccumulator> = Default::default();

    Python::attach(|py| {
        setup_line_builder(py)?;
        let local_api = PyPluginCallApi {
            db_schema: schema,
            query_endpoint,
            write_endpoint,
            write_accumulator: Arc::clone(&write_accumulator),
            logger: Arc::clone(&logger),
            py_cache,
            cancel,
        }
        .into_pyobject(py)
        .map_err(anyhow::Error::from)?;

        let py_datetime = PyDateTime::from_timestamp(py, schedule_time.timestamp() as f64, None)
            .map_err(|e| {
                anyhow::Error::new(e).context(format!(
                    "error converting the schedule time {schedule_time} to Python time: \
                likely python build or libpython issue"
                ))
            })?;

        // turn args into an optional dict to pass into python
        let args = args_to_py_object(py, args).map_err(anyhow::Error::from)?;

        let py_func = load_plugin_function(
            py,
            code,
            plugin_root,
            PROCESS_SCHEDULED_CALL_SITE,
            ExecutePluginError::MissingProcessScheduledCallFunction,
        )?;

        py_func
            .call1((local_api, py_datetime, args))

View on GitHub (pinned to 06200ef96b)