{"record":{"id":"b0d448bdcfe7ca6c","repo":"apache/beam","slug":"error-occurred-while-performing-search-for-query-v","errorCode":null,"errorMessage":"error occurred while performing search for query: [%v]","messagePattern":"error occurred while performing search for query: \\[(.+?)\\]","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdks/go/pkg/beam/io/fhirio/search.go","lineNumber":76,"sourceCode":"\t// Path to FHIR store where search will be performed.\n\tFhirStorePath string\n}\n\nfunc (fn searchResourcesFn) String() string {\n\treturn \"searchResourcesFn\"\n}\n\nfunc (fn *searchResourcesFn) Setup() {\n\tfn.fnCommonVariables.setup(fn.String())\n}\n\nfunc (fn *searchResourcesFn) ProcessElement(ctx context.Context, query SearchQuery, emitFoundResources func(string, []string), emitDeadLetter func(string)) {\n\tresourcesFound, err := executeAndRecordLatency(ctx, &fn.latencyMs, func() ([]string, error) {\n\t\treturn fn.searchResources(ctx, query)\n\t})\n\tif err != nil {\n\t\tfn.resourcesErrorCount.Inc(ctx, 1)\n\t\temitDeadLetter(errors.Wrapf(err, \"error occurred while performing search for query: [%v]\", query).Error())\n\t\treturn\n\t}\n\n\tfn.resourcesSuccessCount.Inc(ctx, 1)\n\temitFoundResources(query.Identifier, resourcesFound)\n}\n\nfunc (fn *searchResourcesFn) searchResources(ctx context.Context, query SearchQuery) ([]string, error) {\n\tresourcesInPage, nextPageToken, err := fn.searchResourcesPaginated(ctx, query, \"\")\n\tallResources := resourcesInPage\n\tfor nextPageToken != \"\" {\n\t\tresourcesInPage, nextPageToken, err = fn.searchResourcesPaginated(ctx, query, nextPageToken)\n\t\tallResources = append(allResources, resourcesInPage...)\n\t}\n\treturn allResources, err\n}\n\n// Performs a search request retrieving results only from the page identified by","sourceCodeStart":58,"sourceCodeEnd":94,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/go/pkg/beam/io/fhirio/search.go#L58-L94","documentation":"searchResourcesFn.ProcessElement executes a FHIR search query via fn.searchResources (which internally pages through SearchQuery results). Any error from the search — transport failure, non-OK API response, or pagination failure — is wrapped with this message including the SearchQuery, emitted to the dead-letter channel, and counted as an error instead of emitting found resources.","triggerScenarios":"executeAndRecordLatency(...searchResources...) returns an error for the given SearchQuery: bad query parameters rejected by the server, network failure, invalid identifier/store path, or errors while fetching subsequent pages of results.","commonSituations":"Invalid FHIR search parameter names in the query (server returns 400); searching a nonexistent resource type; token/auth failures; queries without pagination limits hitting server-side timeouts; Dataflow workers without API access.","solutions":["Validate the SearchQuery parameters against the FHIR store's supported search parameters (CapabilityStatement)","Check the wrapped cause in the dead-letter string for the HTTP status code","Test the equivalent REST call: GET <fhirStore>/fhir/<type>?<params> with the same credentials","Retry with backoff for transient failures; split large searches into smaller pages/date ranges","Verify store path and identity; ensure the resource type exists in the store"],"exampleFix":"// before\nemitDeadLetter(errors.Wrapf(err, \"error occurred while performing search for query: [%v]\", query).Error())\n// after\nif isTransient(err) && attempt < maxAttempts { return retrySearch(query, attempt+1) }\nemitDeadLetter(errors.Wrapf(err, \"error occurred while performing search for query: [%v]\", query).Error())","handlingStrategy":"validation","validationCode":"// check the search parameter is supported by the store\nparams := []string{query.Parameter}\nsupported := fetchSupportedSearchParameters(fhirStoreURL) // from CapabilityStatement\nfor _, p := range params {\n    if !contains(supported, p) { return fmt.Errorf(\"unsupported search param %q\", p) }\n}","typeGuard":null,"tryCatchPattern":"// wrap searchResources with bounded retries\nresult, err := retry(3, backoff, func() ([]string, error) {\n    return fn.searchResources(ctx, query)\n})\nif err != nil { emitDeadLetter(...); return }","preventionTips":["Validate SearchQuery parameters against the store's CapabilityStatement","Test queries via REST before wiring them into the pipeline","Page searches with count/date ranges instead of unbounded queries","Monitor dead-letter output for systemic failures"],"tags":["go","fhirio","search","fhir"],"backgroundTag":"api-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"}