{"record":{"id":"12779f4586c6a37c","repo":"apache/beam","slug":"unable-to-find-running-job-with-name-s","errorCode":null,"errorMessage":"Unable to find running job with name %s","messagePattern":"Unable to find running job with name (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdks/go/pkg/beam/runners/dataflow/dataflowlib/job.go","lineNumber":352,"sourceCode":"\tjobsListCall := client.Projects.Locations.Jobs.List(project, region)\n\tjobsListCall.Filter(\"ACTIVE\")\n\tjobsResponse, err := jobsListCall.Do()\n\tfor {\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tfor _, job := range jobsResponse.Jobs {\n\t\t\tif job.Name == name {\n\t\t\t\treturn job, nil\n\t\t\t}\n\t\t}\n\t\tif jobsResponse.NextPageToken == \"\" {\n\t\t\tbreak\n\t\t}\n\t\tjobsListCall.PageToken(jobsResponse.NextPageToken)\n\t\tjobsResponse, err = jobsListCall.Do()\n\t}\n\treturn nil, errors.New(fmt.Sprintf(\"Unable to find running job with name %s\", name))\n}\n\n// GetMetrics returns a collection of metrics describing the progress of a\n// job by making a call to Cloud Monitoring service.\nfunc GetMetrics(ctx context.Context, client *df.Service, project, region, jobID string) (*df.JobMetrics, error) {\n\treturn client.Projects.Locations.Jobs.GetMetrics(project, region, jobID).Do()\n}\n\n// dataflowOptions provides Dataflow with non Go-specific pipeline options. These are the only\n// pipeline options that are communicated to cross-language SDK harnesses, so any pipeline options\n// needed for cross-language transforms in Dataflow must be declared here.\ntype dataflowOptions struct {\n\tExperiments                    []string `json:\"experiments,omitempty\"`\n\tPipelineURL                    string   `json:\"pipelineUrl\"`\n\tPipelineProtoHash              string   `json:\"pipelineProtoHash,omitempty\"`\n\tRegion                         string   `json:\"region\"`\n\tTempLocation                   string   `json:\"tempLocation\"`\n\tDiskProvisionedIops            int64    `json:\"diskProvisionedIops\"`","sourceCodeStart":334,"sourceCodeEnd":370,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/go/pkg/beam/runners/dataflow/dataflowlib/job.go#L334-L370","documentation":"GetRunningJobByName pages through Dataflow jobs in the given project/region filtering by name, looking for a job in a running state. If the pagination loop completes without matching a job, the function returns this error. It means no currently-running Dataflow job with that exact name exists in that project and region.","triggerScenarios":"Calling GetRunningJobByName (via Submit or Execute) with a job name that does not match any active job in the target project/region, or the job exists but is in a non-running state (done, failed, cancelled, updating) so it is filtered out.","commonSituations":"Attaching to a job after it already finished or was cancelled; a typo in the job name; querying the wrong GCP project or region; the job was launched in a different region than the one queried.","solutions":["Verify the exact job name with `gcloud dataflow jobs list --filter=\"name=<name>\" --region=<region>` and correct any typo.","Confirm the project and region passed to GetRunningJobByName match where the job was actually launched.","Check the job's state; if it is JOB_STATE_DONE/FAILED/CANCELLED it will not be found as a running job — re-launch or query by job ID instead.","If jobs exist but pagination is interrupted, re-run; a transient API failure surfaces as a different error before reaching this line."],"exampleFix":"// before\njob, err := dataflowlib.GetRunningJobByName(ctx, service, project, \"us-central1\", \"my_pipeline\")\n// after (verify actual name/region first, or look up by ID)\njob, err := dataflowlib.GetRunningJobByName(ctx, service, project, \"us-central1\", \"my-pipeline-0912\")","handlingStrategy":"try-catch","validationCode":"// Pre-check with gcloud or list API before attaching:\njobs, _ := dfService.Projects.Locations.Jobs.List(project, region).Filter(\"name=\" + name).Do()\nif len(jobs.Jobs) == 0 || jobs.Jobs[0].CurrentState != \"JOB_STATE_RUNNING\" {\n    // skip attach, launch a new job instead\n}","typeGuard":null,"tryCatchPattern":"job, err := dataflowlib.GetRunningJobByName(ctx, service, project, region, name)\nif err != nil && strings.Contains(err.Error(), \"Unable to find running job\") {\n    // job not running: launch new or use cached job ID\n    return launchNewJob(ctx, p)\n}\nif err != nil {\n    return err\n}","preventionTips":["Persist the job ID returned by Submit and attach by ID instead of by name.","Validate job name format (lowercase letters, digits, hyphens) before submitting.","Pin the region in configuration and reuse it for every lookup.","Remember attaching only matches RUNNING state jobs; finished jobs require a different path."],"tags":["dataflow","gcp","job-lookup","resource-not-found"],"backgroundTag":"entity-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"}