{"record":{"id":"31123d33c9370d1b","repo":"apache/beam","slug":"operation-error-message","errorCode":null,"errorMessage":"operation.Error.Message","messagePattern":"operation\\.Error\\.Message","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdks/go/pkg/beam/io/fhirio/common.go","lineNumber":178,"sourceCode":"}\n\nfunc (c *fhirStoreClientImpl) pollTilCompleteAndCollectResults(operation *healthcare.Operation) (operationResults, error) {\n\toperation, err := c.healthcareService.Projects.Locations.Datasets.Operations.Get(operation.Name).Do()\n\tfor i := 0; err == nil && !operation.Done; {\n\t\ttime.Sleep(backoffDuration[i])\n\t\tif i < len(backoffDuration)-1 {\n\t\t\ti += 1\n\t\t}\n\n\t\toperation, err = c.healthcareService.Projects.Locations.Datasets.Operations.Get(operation.Name).Do()\n\t}\n\n\tif err != nil {\n\t\treturn operationResults{}, err\n\t}\n\n\tif operation.Error != nil {\n\t\treturn operationResults{}, errors.New(operation.Error.Message)\n\t}\n\n\treturn parseOperationCounterResultsFrom(operation.Metadata)\n}\n\nfunc parseOperationCounterResultsFrom(operationMetadata []byte) (operationResults, error) {\n\tvar operationCounterField struct {\n\t\tCounter struct {\n\t\t\toperationResults\n\t\t} `json:\"counter\"`\n\t}\n\terr := json.NewDecoder(bytes.NewReader(operationMetadata)).Decode(&operationCounterField)\n\tif err != nil {\n\t\treturn operationResults{}, err\n\t}\n\treturn operationCounterField.Counter.operationResults, nil\n}\n","sourceCodeStart":160,"sourceCodeEnd":196,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/go/pkg/beam/io/fhirio/common.go#L160-L196","documentation":"fhirio's pollTilCompleteAndCollectResults waits for a long-running Google Cloud Healthcare FHIR operation (from deidentify or importResources) to finish. When the completed operation carries an Error field, the library surfaces the server-provided operation.Error.Message verbatim as a Go error — so the actual message text comes from the FHIR store API, not this SDK.","triggerScenarios":"Calling fhirio.Deidentify or fhirio.ImportResources and polling the returned operation until completion while the server marks the operation as failed; the returned error is the remote operation's error message (e.g. permission denied on the destination store, malformed source bundle, invalid store name).","commonSituations":"De-identifying to a FHIR store in a different project/region without cross-project permissions; importing NDJSON with records that violate FHIR validation; misconfigured Cloud Healthcare dataset/store names; service account lacking healthcare.operations roles.","solutions":["Read the error message text — it is the server-side reason — and address that underlying cause (permissions, store name, payload format).","Verify the service account has roles/healthcare.operationAdmin or equivalent and access to both source and destination stores.","Validate the source data (NDJSON/bundle format, resource types) and destination store configuration before re-running the import/deidentify.","Retry the operation after fixing the cause; poll status via the operation name using Cloud Healthcare APIs for more detail."],"exampleFix":"res, err := fhirio.Deidentify(s, srcStore, dstStore, cfg)\nif err != nil {\n\treturn fmt.Errorf(\"deidentify failed: %w\", err) // message comes from operation.Error.Message\n}\n// Inspect err text: e.g. 'Permission denied on FHIR store' -> grant IAM roles on the destination store.","handlingStrategy":"try-catch","validationCode":"// Pre-checks before fhirio.Deidentify/ImportResources:\n// - service account has healthcare FHIR + operation roles on both stores\n// - store names match projects/<p>/locations/<l>/datasets/<d>/fhirStores/<f>\n// - source NDJSON/ bundles validate against FHIR profiles","typeGuard":null,"tryCatchPattern":"res, err := fhirio.Deidentify(s, src, dst, cfg)\nif err != nil {\n\t// err text originates from the remote operation's Error.Message\n\tlog.Printf(\"FHIR operation failed server-side: %v\", err)\n\treturn fmt.Errorf(\"fhir operation failed: %w\", err)\n}","preventionTips":["Grant the caller IAM roles (healthcare.fhirStoreAdmin / operationAdmin) on both source and destination stores.","Validate FHIR store paths and payload formats before launching the operation.","Log the full operation error text — it names the exact server-side cause.","Test with a small resource batch before large imports/deidentifications."],"tags":["go","apache-beam","fhirio","google-cloud-healthcare","remote-operation-error"],"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"}