{"record":{"id":"6cf673a650d87c70","repo":"apache/beam","slug":"no-cron-schedule-provided-for-vertexmodelmonitoringv2-in","errorCode":null,"errorMessage":"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.","messagePattern":"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\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"sdks/python/apache_beam/ml/inference/vertex_ai_model_monitoring_v2.py","lineNumber":230,"sourceCode":"      logging.warning(\n          \"Failed to list existing schedules: %s. Attempting creation.\", e)\n    return False\n\n  def process(self, element):\n    # Ignore schedule creation if a corresponding one already exists (e.g.\n    # multiple streaming pipelines utilize the same model and write to the\n    # same BigQuery table for monitoring.)\n    if self._schedule_already_exists():\n      logging.info(\n          \"Schedule '%s'%s already exists; skipping schedule creation.\",\n          self.schedule_display_name,\n          f\" with cron '{self.cron}'\" if self.cron else \"\",\n      )\n      return\n    # No cron provided, but no schedule exists either so no monitoring jobs\n    # will be executed.\n    elif not self.cron:\n      raise ValueError(\n          \"No cron schedule provided for VertexModelMonitoringV2 in \"\n          \"streaming pipeline and no pre-existing schedule was found. \"\n          \"Provide a cron schedule or create a model monitor manually before \"\n          \"pipeline execution.\")\n\n    try:\n      self.manager.create_schedule(\n          cron=self.cron,\n          target_dataset=self.target_dataset,\n          display_name=self.schedule_display_name,\n          model_monitoring_job_display_name=self.monitoring_job_display_name,\n          start_time=self.start_time,\n          end_time=self.end_time,\n          tabular_objective_spec=self.tabular_objective_spec,\n          baseline_dataset=self.training_dataset,\n          output_spec=self.output_spec,\n          notification_spec=self.notification_spec,\n          explanation_spec=self.explanation_spec,","sourceCodeStart":212,"sourceCodeEnd":248,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/python/apache_beam/ml/inference/vertex_ai_model_monitoring_v2.py#L212-L248","documentation":"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.","triggerScenarios":"Applying VertexModelMonitoringV2 in a streaming pipeline with cron=None (default) while the created ModelMonitor has no existing monitoring job/schedule attached.","commonSituations":"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.","solutions":["Provide a cron schedule argument to VertexModelMonitoringV2 (e.g. cron='0 */1 * * *' or the cron_period_seconds option)","Create the monitoring schedule manually on the endpoint before running the pipeline so a pre-existing schedule is found","Switch to a batch pipeline where schedule provisioning behaves differently"],"exampleFix":"// before\nmonitoring = VertexModelMonitoringV2(bq_table='bq://p.d', ...)\n// after\nmonitoring = VertexModelMonitoringV2(bq_table='bq://p.d', cron='0 */1 * * *', ...)","handlingStrategy":"validation","validationCode":"is_streaming = pipeline.options.view_as(StandardOptions).streaming\nif is_streaming and cron is None:\n    raise ValueError('VertexModelMonitoringV2 in streaming mode requires a cron schedule')\nmonitoring = VertexModelMonitoringV2(..., cron=cron)","typeGuard":null,"tryCatchPattern":"try:\n    _ = monitoring.expand(results)\nexcept ValueError as e:\n    if 'No cron schedule' in str(e):\n        create_manual_monitoring_schedule(...)\n    raise","preventionTips":["Always pass a cron schedule when using monitoring in streaming pipelines","Or create the monitoring schedule manually before pipeline execution","Reuse a shared streaming config template that includes cron"],"tags":["apache-beam","vertex-ai","streaming","scheduling"],"backgroundTag":"missing-required-argument","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-20T03:17:13.778Z"}