{"record":{"id":"420d59164921d66b","repo":"apache/beam","slug":"presulterr-error","errorCode":null,"errorMessage":"presultErr.Error()","messagePattern":"presultErr\\.Error\\(\\)","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdks/go/pkg/beam/runners/dataflow/dataflowlib/execute.go","lineNumber":149,"sourceCode":"\n\tif endpoint == \"\" {\n\t\tlog.Infof(ctx, \"Console: https://console.cloud.google.com/dataflow/jobs/%v/%v?project=%v\", opts.Region, upd.Id, opts.Project)\n\t}\n\tlog.Infof(ctx, \"Logs: https://console.cloud.google.com/logs/viewer?project=%v&resource=dataflow_step%%2Fjob_id%%2F%v\", opts.Project, upd.Id)\n\n\tpresult.jobID = upd.Id\n\n\tif async {\n\t\treturn presult, nil\n\t}\n\n\t// (4) Wait for completion.\n\terr = WaitForCompletion(ctx, client, opts.Project, opts.Region, upd.Id)\n\n\tres, presultErr := newDataflowPipelineResult(ctx, client, raw, opts.Project, opts.Region, upd.Id)\n\tif presultErr != nil {\n\t\tif err != nil {\n\t\t\treturn presult, errors.Wrap(err, presultErr.Error())\n\t\t}\n\t\treturn presult, presultErr\n\t}\n\treturn res, err\n}\n\n// PrintJob logs the Dataflow job.\nfunc PrintJob(ctx context.Context, job *df.Job) {\n\tstr, err := json.MarshalIndent(job, \"\", \"  \")\n\tif err != nil {\n\t\tlog.Infof(ctx, \"Failed to print job %v: %v\", job.Id, err)\n\t}\n\tlog.Info(ctx, string(str))\n}\n\ntype dataflowPipelineResult struct {\n\tjobID   string\n\tmetrics *metrics.Results","sourceCodeStart":131,"sourceCodeEnd":167,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/go/pkg/beam/runners/dataflow/dataflowlib/execute.go#L131-L167","documentation":"In the Dataflow runner's Execute, after WaitForCompletion the SDK builds a pipeline result via newDataflowPipelineResult. If that call fails (presultErr) while a wait error (err) also exists, both errors are wrapped together and returned alongside a partial result; otherwise presultErr is returned directly. This surfaces failures in fetching final job data/metrics as part of the pipeline execution error.","triggerScenarios":"Executing a Dataflow job whose post-completion result construction fails: newDataflowPipelineResult returns an error (e.g. GetMetrics failing, see error 5327), with or without a concurrent WaitForCompletion error.","commonSituations":"Dataflow API returning errors when fetching job metrics after termination (transient 5xx, permission issues on the job's project), network interruptions between job completion and metrics fetch, or the job being deleted/soft-deleted before metrics can be read.","solutions":["Inspect the wrapped cause (presultErr.Error()) to see why the result could not be built — usually a GetMetrics API failure","Retry the pipeline result retrieval or re-run; transient Dataflow API failures are common","Check the service account has dataflow.jobs.get permission on the project","Check whether the job itself failed (err) — fix the root job failure first if present"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"res, err := beamx.Execute(ctx, p, opts)\nif err != nil {\n    var presult beam.PipelineResult\n    log.Printf(\"pipeline execution/result error: %v\", err)\n    // err may wrap both the job error and the result-construction error\n    _ = presult\n}","preventionTips":["Grant the launcher service account read access to job metrics","Treat post-completion result errors as non-fatal for the job itself — check the Dataflow console for actual job status","Retry result retrieval on transient API failures","Monitor googleapis.com status for outages"],"tags":["go","dataflow","api","pipeline-result"],"backgroundTag":"api-error-response","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"}