{"record":{"id":"6497fc0c241a75bc","repo":"apache/beam","slug":"read-resource-request-returned-error-on-input-v","errorCode":null,"errorMessage":"read resource request returned error on input: [%v]","messagePattern":"read resource request returned error on input: \\[(.+?)\\]","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdks/go/pkg/beam/io/fhirio/read.go","lineNumber":52,"sourceCode":"type readResourceFn struct {\n\tfnCommonVariables\n}\n\nfunc (fn readResourceFn) String() string {\n\treturn \"readResourceFn\"\n}\n\nfunc (fn *readResourceFn) Setup() {\n\tfn.fnCommonVariables.setup(fn.String())\n}\n\nfunc (fn *readResourceFn) ProcessElement(ctx context.Context, resourcePath []byte, emitResource, emitDeadLetter func(string)) {\n\tresponse, err := executeAndRecordLatency(ctx, &fn.latencyMs, func() (*http.Response, error) {\n\t\treturn fn.client.readResource(resourcePath)\n\t})\n\tif err != nil {\n\t\tfn.resourcesErrorCount.Inc(ctx, 1)\n\t\temitDeadLetter(errors.Wrapf(err, \"read resource request returned error on input: [%v]\", resourcePath).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\temitDeadLetter(errors.Wrapf(err, \"could not extract body from read resource [%v] response\", resourcePath).Error())\n\t\treturn\n\t}\n\n\tfn.resourcesSuccessCount.Inc(ctx, 1)\n\temitResource(body)\n}\n\n// Read fetches resources from Google Cloud Healthcare FHIR stores based on the\n// resource path. It consumes a PCollection<string> of notifications from the\n// FHIR store of resource paths, and fetches the actual resource object on the\n// path in the notification. It outputs two PCollection<string>. The first","sourceCodeStart":34,"sourceCodeEnd":70,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/go/pkg/beam/io/fhirio/read.go#L34-L70","documentation":"readResourceFn.ProcessElement calls client.readResource(resourcePath) to GET a single FHIR resource. If the HTTP request fails, the error is wrapped with this message including the input resource path and emitted to the dead-letter channel; the element is not retried automatically by fhirio.","triggerScenarios":"fn.client.readResource(resourcePath) returns a non-nil error: DNS/network failure, invalid resourcePath (malformed projects/.../fhirStores/<s>/fhir/<type>/<id> path), timeouts, or a failed access token refresh inside the client.","commonSituations":"Resource ID typos in the source PCollection; store deleted or renamed between pipeline stages; no network from Dataflow workers; expired/insufficient credentials for the Healthcare API.","solutions":["Verify each resourcePath is a valid full FHIR resource path and the resource exists (curl the URL directly)","Check worker network egress to healthcare.googleapis.com (VPC settings, firewall)","Validate credentials/scopes (cloud-healthcare scope, ADC configured on workers)","Implement a retry/dead-letter replay: read emitDeadLetter output and reprocess failed paths with backoff","Confirm the FHIR store was not deleted/moved mid-pipeline"],"exampleFix":"// before\nemitDeadLetter(errors.Wrapf(err, \"read resource request returned error on input: [%v]\", resourcePath).Error())\n// after\nif isTransient(err) {\n    return retryRead(resourcePath, 3) // exponential backoff\n}\nemitDeadLetter(errors.Wrapf(err, \"read resource request returned error on input: [%v]\", resourcePath).Error())","handlingStrategy":"retry","validationCode":"resourcePath := \"projects/p/locations/l/datasets/d/fhirStores/s/fhir/Patient/123\"\nparts := strings.Split(resourcePath, \"/\")\nif len(parts) != 10 || parts[8] != \"fhir\" { return fmt.Errorf(\"bad resource path: %s\", resourcePath) }","typeGuard":null,"tryCatchPattern":"// wrap reads with backoff retry for transient errors\nfor attempt := 0; attempt < 3; attempt++ {\n    resp, err := client.readResource(path)\n    if err == nil { return resp }\n    if !isTransient(err) { break }\n    time.Sleep(backoff(attempt))\n}","preventionTips":["Sanity-check resource IDs in upstream PCollections","Verify store and resources exist before the pipeline runs","Ensure workers have healthcare API egress and credentials","Always route failures to the dead-letter channel and monitor it"],"tags":["go","fhirio","network","http"],"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"}