apache/beam · error · ValueError

No cron schedule provided for VertexModelMonitoringV2 in…

Error message

No cron schedule provided for VertexModelMonitoringV2 in streaming pipeline and no pre-existing schedule was found. Provide a cron schedule or create a model monitor manually before pipeline execution.

What it means

For streaming pipelines, VertexModelMonitoringV2's process step needs either a cron schedule or an already-registered monitoring schedule on the model monitor. If no cron was provided and no pre-existing schedule is found, it raises ValueError because monitoring jobs would never run in a streaming context.

Solutions

  1. Provide a cron schedule argument to VertexModelMonitoringV2 (e.g. cron='0 */1 * * *' or the cron_period_seconds option)
  2. Create the monitoring schedule manually on the endpoint before running the pipeline so a pre-existing schedule is found
  3. Switch to a batch pipeline where schedule provisioning behaves differently

Example fix

// before
monitoring = VertexModelMonitoringV2(bq_table='bq://p.d', ...)
// after
monitoring = VertexModelMonitoringV2(bq_table='bq://p.d', cron='0 */1 * * *', ...)
Defensive patterns

Strategy: validation

Validate before calling

is_streaming = pipeline.options.view_as(StandardOptions).streaming
if is_streaming and cron is None:
    raise ValueError('VertexModelMonitoringV2 in streaming mode requires a cron schedule')
monitoring = VertexModelMonitoringV2(..., cron=cron)

Try / catch

try:
    _ = monitoring.expand(results)
except ValueError as e:
    if 'No cron schedule' in str(e):
        create_manual_monitoring_schedule(...)
    raise

Prevention

When it happens

Trigger: Applying VertexModelMonitoringV2 in a streaming pipeline with cron=None (default) while the created ModelMonitor has no existing monitoring job/schedule attached.

Common situations: Reusing a batch-pipeline config in a streaming job; forgetting to pass cron_period_seconds/cron to the transform; expecting monitoring to be set up automatically.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


AI-assisted analysis of apache/beam@12126d8942 (2026-09-13). Data as JSON: /api/errors/6cf673a650d87c70. Report an issue: GitHub.

Appendix: source

Thrown at sdks/python/apache_beam/ml/inference/vertex_ai_model_monitoring_v2.py:230

      logging.warning(
          "Failed to list existing schedules: %s. Attempting creation.", e)
    return False

  def process(self, element):
    # Ignore schedule creation if a corresponding one already exists (e.g.
    # multiple streaming pipelines utilize the same model and write to the
    # same BigQuery table for monitoring.)
    if self._schedule_already_exists():
      logging.info(
          "Schedule '%s'%s already exists; skipping schedule creation.",
          self.schedule_display_name,
          f" with cron '{self.cron}'" if self.cron else "",
      )
      return
    # No cron provided, but no schedule exists either so no monitoring jobs
    # will be executed.
    elif not self.cron:
      raise ValueError(
          "No cron schedule provided for VertexModelMonitoringV2 in "
          "streaming pipeline and no pre-existing schedule was found. "
          "Provide a cron schedule or create a model monitor manually before "
          "pipeline execution.")

    try:
      self.manager.create_schedule(
          cron=self.cron,
          target_dataset=self.target_dataset,
          display_name=self.schedule_display_name,
          model_monitoring_job_display_name=self.monitoring_job_display_name,
          start_time=self.start_time,
          end_time=self.end_time,
          tabular_objective_spec=self.tabular_objective_spec,
          baseline_dataset=self.training_dataset,
          output_spec=self.output_spec,
          notification_spec=self.notification_spec,
          explanation_spec=self.explanation_spec,

View on GitHub (pinned to 12126d8942)