apache/beam · error
err
Error message
err
What it means
In bigqueryio.query, each QueryOptions function may validate parameters and return an error. The library panics immediately when an option returns an error, surfacing the option's error message (shown here as the raw 'err' panic) to the user.
Solutions
- Fix the failing QueryOptions function's inputs — use supported scalar types for query parameters.
- Validate option arguments before building the pipeline.
- Check the panic's error text for which option failed and correct that call.
Example fix
// before
bigqueryio.Query(s, project, q, t, bigqueryio.WithQueryParameter("ids", []myStruct{...})) // option returns error
// after
bigqueryio.Query(s, project, q, t, bigqueryio.WithQueryParameter("ids", []int64{1, 2, 3})) Defensive patterns
Strategy: validation
Validate before calling
for _, opt := range options {
tmp := bigqueryio.QueryOptions{}
if err := opt(&tmp); err != nil {
return err
}
} Try / catch
func safeQuery(s beam.Scope, proj, q string, t reflect.Type, opts ...func(*bigqueryio.QueryOptions) error) (pc beam.PCollection, err error) {
defer func() {
if r := recover(); r != nil {
err = fmt.Errorf("bigqueryio.Query failed: %v", r)
}
}()
return bigqueryio.Query(s, proj, q, t, opts...), nil
} Prevention
- Pre-validate option values before passing them to bigqueryio.Query.
- Use only supported scalar types for query parameters.
When it happens
Trigger: Passing a query option func(*QueryOptions) error that returns non-nil — e.g. WithQueryParameter with a value whose type cannot be encoded, or WithQueryPriority-like validation failure.
Common situations: Passing unsupported Go types as query parameters (arrays, structs) to WithQueryParameter, or a custom option rejecting conflicting settings.
Understand the failure class
Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.
Related errors
- bigqueryio.Read: type
- invalid schema type
- requires either a Table or Query specified, received none
- A BigQuery table or a query must be specified
- A function must be provided to convert the input type into…
AI-assisted analysis of apache/beam@12126d8942 (2026-09-13).
Data as JSON: /api/errors/3a743b8bc711989e.
Report an issue: GitHub.
Appendix: source
Thrown at sdks/go/pkg/beam/io/bigqueryio/bigquery.go:154
qo.parameters = params
return nil
}
}
// Query executes a query. The output must have a schema compatible with the given
// type, t. It returns a PCollection<t>.
func Query(s beam.Scope, project, q string, t reflect.Type, options ...func(*QueryOptions) error) beam.PCollection {
s = s.Scope("bigquery.Query")
return query(s, project, q, t, options...)
}
func query(s beam.Scope, project, query string, t reflect.Type, options ...func(*QueryOptions) error) beam.PCollection {
mustInferSchema(t)
queryOptions := QueryOptions{}
for _, opt := range options {
if err := opt(&queryOptions); err != nil {
panic(err)
}
}
imp := beam.Impulse(s)
queryParameters, err := encodeQueryParameters(queryOptions.parameters)
if err != nil {
panic(errors.Wrapf(err, "bigqueryio.Query: failed to encode query parameters"))
}
return beam.ParDo(
s,
&queryFn{Project: project, Query: query, Type: beam.EncodedType{T: t}, QueryParameters: queryParameters, Options: queryOptions},
imp,
beam.TypeDefinition{Var: beam.XType, T: t},
)
}
type queryFn struct {
// Project is the project.View on GitHub (pinned to 12126d8942)