{"record":{"id":"9f325adb7bbafb03","repo":"influxdata/influxdb","slug":"error-converting-the-schedule-time-schedule-time-to-python","errorCode":null,"errorMessage":"error converting the schedule time {schedule_time} to Python time: likely python build or libpython issue","messagePattern":"error converting the schedule time (.+?) to Python time: likely python build or libpython issue","errorType":"error_code","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"influxdb3_py_api/src/system_py.rs","lineNumber":498,"sourceCode":"    let write_accumulator: Arc<WriteAccumulator> = Default::default();\n\n    Python::attach(|py| {\n        setup_line_builder(py)?;\n        let local_api = PyPluginCallApi {\n            db_schema: schema,\n            query_endpoint,\n            write_endpoint,\n            write_accumulator: Arc::clone(&write_accumulator),\n            logger: Arc::clone(&logger),\n            py_cache,\n            cancel,\n        }\n        .into_pyobject(py)\n        .map_err(anyhow::Error::from)?;\n\n        let py_datetime = PyDateTime::from_timestamp(py, schedule_time.timestamp() as f64, None)\n            .map_err(|e| {\n                anyhow::Error::new(e).context(format!(\n                    \"error converting the schedule time {schedule_time} to Python time: \\\n                likely python build or libpython issue\"\n                ))\n            })?;\n\n        // turn args into an optional dict to pass into python\n        let args = args_to_py_object(py, args).map_err(anyhow::Error::from)?;\n\n        let py_func = load_plugin_function(\n            py,\n            code,\n            plugin_root,\n            PROCESS_SCHEDULED_CALL_SITE,\n            ExecutePluginError::MissingProcessScheduledCallFunction,\n        )?;\n\n        py_func\n            .call1((local_api, py_datetime, args))","sourceCodeStart":480,"sourceCodeEnd":516,"githubUrl":"https://github.com/influxdata/influxdb/blob/06200ef96ba82c5f6727e5038a83af8e722c6875/influxdb3_py_api/src/system_py.rs#L480-L516","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["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).","Point PYTHONHOME/PYTHONPATH at a complete Python installation and restart the server.","If using a custom build, rebuild libpython with the datetime C extension enabled (`make` full build, ensure _datetime module is present in lib-dynload).","Check the schedule_time value is a sane Unix timestamp within Python datetime's supported range (year 1–9999)."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// sanity-check the embedded Python's datetime support at startup\nimport subprocess, sys\nr = subprocess.run([sys.executable, \"-c\",\n  \"import datetime; datetime.datetime.fromtimestamp(0)\"], capture_output=True)\nif r.returncode != 0:\n    raise SystemExit(\"Embedded Python datetime module is broken; reinstall full Python\")","typeGuard":null,"tryCatchPattern":"try {\n  triggerSchedule(scheduleTime, args);\n} catch (e) {\n  if (String(e.message).includes(\"converting the schedule time\")) {\n    console.error(\"libpython/datetime broken — verify full Python install and PYTHONHOME\");\n  } else throw e;\n}","preventionTips":["Install a complete Python distribution (not python3-minimal) for the embedded interpreter.","After Python upgrades/rebuilds, run a sanity check that `datetime.datetime.fromtimestamp` works.","Keep schedule timestamps within the representable range (Unix year 1–9999).","Ensure PYTHONHOME/PYTHONPATH point at an intact stdlib including lib-dynload/_datetime."],"tags":["python-plugins","libpython","datetime","schedule"],"backgroundTag":"unsupported-platform","analyzedSha":"06200ef96ba82c5f6727e5038a83af8e722c6875","analyzedAt":"2026-09-19T12:55:30.003Z","contentChangedAt":"2026-09-19T12:55:30.003Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}