{"record":{"id":"758181dcd62f56c5","repo":"apache/beam","slug":"bigqueryio-queryfn-failed-to-decode-query-parameters","errorCode":null,"errorMessage":"bigqueryio.queryFn: failed to decode query parameters","messagePattern":"bigqueryio\\.queryFn: failed to decode query parameters","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdks/go/pkg/beam/io/bigqueryio/bigquery.go","lineNumber":197,"sourceCode":"\tQueryParameters []byte `json:\"query_parameters\"`\n\t// Options specifies additional query execution options.\n\tOptions QueryOptions `json:\"options\"`\n}\n\nfunc (f *queryFn) ProcessElement(ctx context.Context, _ []byte, emit func(beam.X)) error {\n\tclient, err := bigquery.NewClient(ctx, f.Project)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer client.Close()\n\n\tq := client.Query(f.Query)\n\tif !f.Options.UseStandardSQL {\n\t\tq.UseLegacySQL = true\n\t}\n\tparameters, err := decodeQueryParameters(f.QueryParameters)\n\tif err != nil {\n\t\treturn errors.Wrapf(err, \"bigqueryio.queryFn: failed to decode query parameters\")\n\t}\n\tq.Parameters = parameters\n\n\tit, err := q.Read(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tfor {\n\t\tval := reflect.New(f.Type.T).Interface() // val : *T\n\t\tif err := it.Next(val); err != nil {\n\t\t\tif err == iterator.Done {\n\t\t\t\tbreak\n\t\t\t}\n\t\t\treturn err\n\t\t}\n\n\t\temit(reflect.ValueOf(val).Elem().Interface()) // emit(*val)","sourceCodeStart":179,"sourceCodeEnd":215,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/go/pkg/beam/io/bigqueryio/bigquery.go#L179-L215","documentation":"Inside queryFn.ProcessElement (sdks/go/pkg/beam/io/bigqueryio/bigquery.go), the worker decodes the driver-encoded query parameters with decodeQueryParameters before issuing the BigQuery query; failure is wrapped as \"bigqueryio.queryFn: failed to decode query parameters\" and returned from the DoFn. It indicates the encoded parameter blob carried on the impulse side does not decode on the worker.","triggerScenarios":"Running a pipeline where the worker's Beam version differs from the driver's (encoding/decoding format mismatch), or corrupt parameter bytes in the impulse side-input.","commonSituations":"Mixed SDK versions between job submission and workers (stale worker images), non-deterministic encoding of parameters, or custom modifications to encodeQueryParameters/decodeQueryParameters.","solutions":["Ensure driver and workers use the same Beam SDK version (rebuild/redeploy worker images).","Inspect the wrapped error to see whether it is a versioned format mismatch or corruption.","Re-submit the pipeline so parameters are freshly encoded with the current code.","Simplify parameters to supported scalar types to rule out type-specific decode failures."],"exampleFix":"// before: mixed versions in deployment\ngo get github.com/apache/beam/sdks/go/pkg/beam@v2.40.0  # driver only\n// after: pin same version everywhere\ngo get github.com/apache/beam/sdks/go/pkg/beam@v2.50.0\n# and rebuild worker container image with the same version","handlingStrategy":"retry","validationCode":"// driver-side: confirm params round-trip\nif _, err := decodeQueryParameters(encodeForTest(params)); err != nil {\n    return fmt.Errorf(\"params will fail on worker: %w\", err)\n}","typeGuard":null,"tryCatchPattern":"if err := doFnErr; strings.Contains(err.Error(), \"failed to decode query parameters\") {\n    return fmt.Errorf(\"worker/driver Beam version mismatch: %w\", err) // alert, resubmit\n}","preventionTips":["Pin the same Beam SDK version on driver and worker images","Round-trip encode/decode parameters in a unit test before submitting jobs","Resubmit with freshly built workers after upgrading Beam"],"tags":["bigquery","decoding","query-parameters","beam-io"],"backgroundTag":"json-decode-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"}