apache/beam · error

operation.Error.Message

Error message

operation.Error.Message

What it means

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.

Solutions

  1. Read the error message text — it is the server-side reason — and address that underlying cause (permissions, store name, payload format).
  2. Verify the service account has roles/healthcare.operationAdmin or equivalent and access to both source and destination stores.
  3. Validate the source data (NDJSON/bundle format, resource types) and destination store configuration before re-running the import/deidentify.
  4. Retry the operation after fixing the cause; poll status via the operation name using Cloud Healthcare APIs for more detail.

Example fix

res, err := fhirio.Deidentify(s, srcStore, dstStore, cfg)
if err != nil {
	return fmt.Errorf("deidentify failed: %w", err) // message comes from operation.Error.Message
}
// Inspect err text: e.g. 'Permission denied on FHIR store' -> grant IAM roles on the destination store.
Defensive patterns

Strategy: try-catch

Validate before calling

// Pre-checks before fhirio.Deidentify/ImportResources:
// - service account has healthcare FHIR + operation roles on both stores
// - store names match projects/<p>/locations/<l>/datasets/<d>/fhirStores/<f>
// - source NDJSON/ bundles validate against FHIR profiles

Try / catch

res, err := fhirio.Deidentify(s, src, dst, cfg)
if err != nil {
	// err text originates from the remote operation's Error.Message
	log.Printf("FHIR operation failed server-side: %v", err)
	return fmt.Errorf("fhir operation failed: %w", err)
}

Prevention

When it happens

Trigger: 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).

Common situations: 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.

Related errors


AI-assisted analysis of apache/beam@12126d8942 (2026-09-13). Data as JSON: /api/errors/31123d33c9370d1b. Report an issue: GitHub.

Appendix: source

Thrown at sdks/go/pkg/beam/io/fhirio/common.go:178

}

func (c *fhirStoreClientImpl) pollTilCompleteAndCollectResults(operation *healthcare.Operation) (operationResults, error) {
	operation, err := c.healthcareService.Projects.Locations.Datasets.Operations.Get(operation.Name).Do()
	for i := 0; err == nil && !operation.Done; {
		time.Sleep(backoffDuration[i])
		if i < len(backoffDuration)-1 {
			i += 1
		}

		operation, err = c.healthcareService.Projects.Locations.Datasets.Operations.Get(operation.Name).Do()
	}

	if err != nil {
		return operationResults{}, err
	}

	if operation.Error != nil {
		return operationResults{}, errors.New(operation.Error.Message)
	}

	return parseOperationCounterResultsFrom(operation.Metadata)
}

func parseOperationCounterResultsFrom(operationMetadata []byte) (operationResults, error) {
	var operationCounterField struct {
		Counter struct {
			operationResults
		} `json:"counter"`
	}
	err := json.NewDecoder(bytes.NewReader(operationMetadata)).Decode(&operationCounterField)
	if err != nil {
		return operationResults{}, err
	}
	return operationCounterField.Counter.operationResults, nil
}

View on GitHub (pinned to 12126d8942)