{"record":{"id":"127e4bb29972df6a","repo":"apache/beam","slug":"no-running-job-found-with-name-s","errorCode":null,"errorMessage":"No running job found with name '%s'","messagePattern":"No running job found with name '(.+?)'","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"sdks/python/apache_beam/runners/dataflow/internal/apiclient.py","lineNumber":1094,"sourceCode":"    response = self._messages_client.list_job_messages(request=request)\n    return response.job_messages, response.next_page_token\n\n  def job_id_for_name(self, job_name):\n    token = None\n    while True:\n      request = dataflow.ListJobsRequest(\n          project_id=self.google_cloud_options.project,\n          location=self.google_cloud_options.region,\n          page_token=token)\n      response = self._jobs_client.list_jobs(request)\n      for job in response:\n        if (job.name == job_name and\n            job.current_state in [dataflow.JobState.JOB_STATE_RUNNING,\n                                  dataflow.JobState.JOB_STATE_DRAINING]):\n          return job.id\n      token = response.next_page_token\n      if token is None:\n        raise ValueError(\"No running job found with name '%s'\" % job_name)\n\n\nclass MetricUpdateTranslators(object):\n  \"\"\"Translators between accumulators and dataflow metric updates.\"\"\"\n  @staticmethod\n  def translate_boolean(\n      accumulator, metric_update_proto: dataflow.MetricUpdate):\n    metric_update_proto.scalar = accumulator.value\n\n  @staticmethod\n  def translate_scalar_mean_int(\n      accumulator, metric_update_proto: dataflow.MetricUpdate):\n    if accumulator.count:\n      metric_update_proto.kind = 'Mean'\n      metric_update_proto.mean_sum = accumulator.sum\n      metric_update_proto.mean_count = accumulator.count\n    else:\n      metric_update_proto.kind = None  # type: ignore","sourceCodeStart":1076,"sourceCodeEnd":1112,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/python/apache_beam/runners/dataflow/internal/apiclient.py#L1076-L1112","documentation":"ValueError from job_id_for_name when it pages through all jobs visible to the project and finds none whose name matches and whose current state is RUNNING or DRAINING. The lookup only considers running/draining jobs, so completed, failed, or cancelled jobs are invisible to it.","triggerScenarios":"Calling job_id_for_name(name) when no job with that exact name is currently running or draining — the job finished, was cancelled, the name is misspelled, or the job lives in a different project/region.","commonSituations":"Looking up a job after it already completed; case-sensitive name mismatch; job name vs job id confusion; running against the wrong GCP project.","solutions":["Verify the job is currently RUNNING or DRAINING in the Dataflow console; use a different lookup (list all jobs) if it finished.","Check the job name spelling and case exactly matches the Dataflow job name.","Confirm the client's project/region options point at where the job runs."],"exampleFix":"// before\njob_id = client.job_id_for_name('my_job')  # job already finished -> ValueError\n// after\n# guard: ensure the job exists and is active, or handle the error\ntry:\n  job_id = client.job_id_for_name('my_job')\nexcept ValueError:\n  job_id = None  # job not running (yet/anymore)","handlingStrategy":"try-catch","validationCode":"active = [j for j in client._jobs_client.list_jobs(project=proj).jobs\n          if j.name == job_name and j.current_state in ('JOB_STATE_RUNNING','JOB_STATE_DRAINING')]\nif not active:\n    logging.warning('No active job named %s', job_name)","typeGuard":null,"tryCatchPattern":"try:\n    job_id = client.job_id_for_name(name)\nexcept ValueError as e:\n    if 'No running job found' in str(e):\n        job_id = None  # job finished or never existed\n    else:\n        raise","preventionTips":["Only look up jobs you know are still running; track job ids returned at submission time instead.","Remember the lookup ignores finished/failed/cancelled jobs.","Match the job name exactly (case-sensitive)."],"tags":["python","apache-beam","dataflow","job-not-found"],"backgroundTag":"record-not-found","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"}