{"record":{"id":"92c44b428eca5211","repo":"apache/beam","slug":"execute-bundle-request-returned-error","errorCode":null,"errorMessage":"execute bundle request returned error","messagePattern":"execute bundle request returned error","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdks/go/pkg/beam/io/fhirio/execute_bundles.go","lineNumber":65,"sourceCode":"\tFhirStorePath string\n}\n\nfunc (fn executeBundleFn) String() string {\n\treturn \"executeBundleFn\"\n}\n\nfunc (fn *executeBundleFn) Setup() {\n\tfn.fnCommonVariables.setup(fn.String())\n\tfn.successesCount = beam.NewCounter(fn.String(), baseMetricPrefix+\"success_count\")\n}\n\nfunc (fn *executeBundleFn) ProcessElement(ctx context.Context, inputBundleBody string, emitSuccess, emitFailure func(string)) {\n\tresponse, err := executeAndRecordLatency(ctx, &fn.latencyMs, func() (*http.Response, error) {\n\t\treturn fn.client.executeBundle(fn.FhirStorePath, inputBundleBody)\n\t})\n\tif err != nil {\n\t\tfn.resourcesErrorCount.Inc(ctx, 1)\n\t\temitFailure(errors.Wrap(err, \"execute bundle request returned error\").Error())\n\t\treturn\n\t}\n\n\tbody, err := extractBodyFrom(response)\n\tif err != nil {\n\t\tfn.resourcesErrorCount.Inc(ctx, 1)\n\t\temitFailure(errors.Wrap(err, \"could not extract body from execute bundles response\").Error())\n\t\treturn\n\t}\n\n\tfn.processResponseBody(ctx, body, emitSuccess, emitFailure)\n}\n\nfunc (fn *executeBundleFn) processResponseBody(ctx context.Context, body string, emitSuccess, emitFailure func(string)) {\n\tvar bodyFields struct {\n\t\tType    string `json:\"type\"`\n\t\tEntries []any  `json:\"entry\"`\n\t}","sourceCodeStart":47,"sourceCodeEnd":83,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/go/pkg/beam/io/fhirio/execute_bundles.go#L47-L83","documentation":"fhirio's executeBundleFn.ProcessElement sends a FHIR executeBundle HTTP request via the stored FHIR client. If the transport call itself fails (network error, non-recoverable client error, context cancellation), it wraps the error with this message and emits it to the failure/dead-letter channel while incrementing the error counter, then stops processing that bundle. The pipeline does not crash; the failed bundle body is surfaced as a failure string.","triggerScenarios":"fn.client.executeBundle(fn.FhirStorePath, inputBundleBody) returns a non-nil error: network failure to the FHIR store, invalid FHIR store path causing HTTP client errors, request timeouts, or a cancelled context passed to executeAndRecordLatency.","commonSituations":"Running a Beam Go pipeline in an environment without network access to the Google Healthcare API; misconfigured FHIR store path (wrong project/region/dataset/fhirStore); missing OAuth credentials or wrong scopes; GKE/Dataflow networking/firewall rules blocking googleapis.com.","solutions":["Verify the FHIR store path matches projects/<p>/locations/<l>/datasets/<d>/fhirStores/<s> and that the store exists","Check network connectivity to healthcare.googleapis.com from the worker (VPC/firewall/DNS, Service Networking for private access)","Confirm credentials: Application Default Credentials with healthcare scope (https://www.googleapis.com/auth/cloud-healthcare)","Retry failed bundles: the error is emitted to emitFailure, so collect failures and re-execute them in a follow-up step","Wrap with retry/backoff for transient 5xx/network errors"],"exampleFix":"// before\nemitFailure(errors.Wrap(err, \"execute bundle request returned error\").Error())\n// after\n// enable retries for transient errors before executing:\nresponse, err := executeAndRecordLatency(ctx, &fn.latencyMs, func() (*http.Response, error) {\n    return fn.client.executeBundle(fn.FhirStorePath, inputBundleBody)\n})\nif err != nil && isTransient(err) { return retryBundle(inputBundleBody) }\nif err != nil { emitFailure(errors.Wrap(err, \"execute bundle request returned error\").Error()) }","handlingStrategy":"try-catch","validationCode":"storePath := \"projects/my-proj/locations/us-central1/datasets/my-ds/fhirStores/my-store\"\nif !strings.HasPrefix(storePath, \"projects/\") || strings.Count(storePath, \"/\") != 7 {\n    return fmt.Errorf(\"invalid FHIR store path: %s\", storePath)\n}\nif err := validateNetworkToHost(\"healthcare.googleapis.com\"); err != nil { return err }","typeGuard":null,"tryCatchPattern":"// process the emitFailure stream as the catch point\nbeam.ParDo(s, &fhirio.ExecuteBundles{...}, bundles)\n// downstream: inspect emitted failure strings, filter transient causes, and re-emit for retry","preventionTips":["Validate the FHIR store path format before building the pipeline","Pre-flight connectivity/credential checks in the job setup step","Emit failures to a durable dead-letter sink and replay them","Use bundles of moderate size to reduce timeout exposure"],"tags":["go","fhirio","network","google-cloud-healthcare"],"backgroundTag":"http-request-failed","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"}