{"record":{"id":"d048a08b2a511ea4","repo":"apache/beam","slug":"bigqueryio-query-parameter-q-has-unsupported-value-type-t-v","errorCode":null,"errorMessage":"bigqueryio: query parameter %q has unsupported value type %T (%v). WithQueryParameters only supports bool, string, numeric types, []byte, time.Time, civil.Date/Time/DateTime, *big.Rat, bigquery.Null* types, *bigquery.IntervalValue, *bigquery.RangeValue, and *bigquery.QueryParameterValue. For STRUCT/ARRAY parameters or other custom types, build a *bigquery.QueryParameterValue explicitly instead","messagePattern":"bigqueryio: query parameter %q has unsupported value type %T \\((.+?)\\)\\. WithQueryParameters only supports bool, string, numeric types, \\[\\]byte, time\\.Time, civil\\.Date/Time/DateTime, \\*big\\.Rat, bigquery\\.Null\\* types, \\*bigquery\\.IntervalValue, \\*bigquery\\.RangeValue, and \\*bigquery\\.QueryParameterValue\\. For STRUCT/ARRAY parameters or other custom types, build a \\*bigquery\\.QueryParameterValue explicitly instead","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdks/go/pkg/beam/io/bigqueryio/coder.go","lineNumber":63,"sourceCode":"\tgob.Register(bigquery.NullGeography{})\n\tgob.Register(bigquery.NullJSON{})\n\tgob.Register(civil.Date{})\n\tgob.Register(civil.Time{})\n\tgob.Register(civil.DateTime{})\n\tgob.Register(time.Time{})\n\tgob.Register(&big.Rat{})\n\tgob.Register(&bigquery.IntervalValue{})\n\tgob.Register(&bigquery.RangeValue{})\n}\n\nfunc encodeQueryParameters(params []bigquery.QueryParameter) ([]byte, error) {\n\tif params == nil {\n\t\treturn []byte{}, nil\n\t}\n\t// validate each element to tell which parameter is unsupported.\n\tfor _, p := range params {\n\t\tif err := gob.NewEncoder(io.Discard).Encode([]bigquery.QueryParameter{p}); err != nil {\n\t\t\treturn nil, errors.Errorf(\n\t\t\t\t\"bigqueryio: query parameter %q has unsupported value type %T (%v). \"+\n\t\t\t\t\t\"WithQueryParameters only supports bool, string, numeric types, []byte, \"+\n\t\t\t\t\t\"time.Time, civil.Date/Time/DateTime, *big.Rat, bigquery.Null* types, \"+\n\t\t\t\t\t\"*bigquery.IntervalValue, *bigquery.RangeValue, and *bigquery.QueryParameterValue. \"+\n\t\t\t\t\t\"For STRUCT/ARRAY parameters or other custom types, build a \"+\n\t\t\t\t\t\"*bigquery.QueryParameterValue explicitly instead\", p.Name, p.Value, err)\n\t\t}\n\t}\n\tvar buf bytes.Buffer\n\tif err := gob.NewEncoder(&buf).Encode(params); err != nil {\n\t\treturn nil, err\n\t}\n\treturn buf.Bytes(), nil\n}\n\nfunc decodeQueryParameters(data []byte) ([]bigquery.QueryParameter, error) {\n\tif len(data) == 0 {\n\t\treturn []bigquery.QueryParameter{}, nil","sourceCodeStart":45,"sourceCodeEnd":81,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/go/pkg/beam/io/bigqueryio/coder.go#L45-L81","documentation":"encodeQueryParameters serializes bigquery.QueryParameter values with gob so they can travel with the query to workers. Before encoding, each parameter is test-encoded; any value type gob cannot encode (channels, funcs, unregistered concrete types, etc.) produces this long error naming the parameter, its Go type, and the gob error. STRUCT/ARRAY parameters must be built as *bigquery.QueryParameterValue explicitly.","triggerScenarios":"Calling bigqueryio.Query with WithQueryParameters containing a parameter whose Value is a type outside the supported set: e.g. a custom struct, map, slice of structs, channel, or func.","commonSituations":"Passing a Go struct as a STRUCT parameter directly; passing []MyType for an ARRAY parameter; gob-unregistered custom named types (e.g. a custom string type) that gob refuses to encode; upgrading code that previously used only scalars to complex parameters.","solutions":["For STRUCT/ARRAY parameters, construct a *bigquery.QueryParameterValue with the right Type and ArrayValue/StructValue fields instead of a raw Go value.","Restrict WithQueryParameters values to the supported set: bool, strings, numerics, []byte, time.Time, civil.Date/Time/DateTime, *big.Rat, bigquery.Null*, *bigquery.IntervalValue, *bigquery.RangeValue.","If a custom named scalar type is intended, convert it to its underlying primitive (string(p), int64(i)) before passing it.","Run the parameter through gob encoding locally first to confirm encodability before submitting the query."],"exampleFix":"// before\nparams := bigqueryio.WithQueryParameters([]bigquery.QueryParameter{\n  {Name: \"filter\", Value: myStruct{}}, // gob cannot encode\n})\n\n// after\nqv, _ := bigquery.QueryParameterValueFromSchema(mySchema) // or build manually\nparams := bigqueryio.WithQueryParameters([]bigquery.QueryParameter{\n  {Name: \"filter\", ParameterType: &bigquery.QueryParameterType{Type: \"STRUCT\", StructTypes: st}, ParameterValue: &bigquery.QueryParameterValue{StructValues: vals}},\n})","handlingStrategy":"validation","validationCode":"func validateParams(params []bigquery.QueryParameter) error {\n\tfor _, p := range params {\n\t\tif err := gob.NewEncoder(io.Discard).Encode([]bigquery.QueryParameter{p}); err != nil {\n\t\t\treturn fmt.Errorf(\"parameter %q of type %T is not supported: %w\", p.Name, p.Value, err)\n\t\t}\n\t}\n\treturn nil\n}","typeGuard":"func isSupportedParamValue(v any) bool {\n\tswitch v.(type) {\n\tcase bool, string, int, int8, int16, int32, int64, uint, uint8, uint16, uint32, uint64, float32, float64, []byte, time.Time, civil.Date, civil.Time, civil.DateTime, *big.Rat, *bigquery.IntervalValue, *bigquery.RangeValue, *bigquery.QueryParameterValue:\n\t\treturn true\n\tdefault:\n\t\treturn false\n\t}\n}","tryCatchPattern":null,"preventionTips":["Build STRUCT/ARRAY parameters explicitly as *bigquery.QueryParameterValue.","Convert custom named scalar types to their primitives before passing as parameter values.","Unit-test query parameters with gob encoding before running the pipeline."],"tags":["bigquery","query-parameters","gob","go"],"backgroundTag":"invalid-query-parameter","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"}