{"record":{"id":"3a743b8bc711989e","repo":"apache/beam","slug":"err-bigquery","errorCode":null,"errorMessage":"err","messagePattern":"err","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdks/go/pkg/beam/io/bigqueryio/bigquery.go","lineNumber":154,"sourceCode":"\t\tqo.parameters = params\n\t\treturn nil\n\t}\n}\n\n// Query executes a query. The output must have a schema compatible with the given\n// type, t. It returns a PCollection<t>.\nfunc Query(s beam.Scope, project, q string, t reflect.Type, options ...func(*QueryOptions) error) beam.PCollection {\n\ts = s.Scope(\"bigquery.Query\")\n\treturn query(s, project, q, t, options...)\n}\n\nfunc query(s beam.Scope, project, query string, t reflect.Type, options ...func(*QueryOptions) error) beam.PCollection {\n\tmustInferSchema(t)\n\n\tqueryOptions := QueryOptions{}\n\tfor _, opt := range options {\n\t\tif err := opt(&queryOptions); err != nil {\n\t\t\tpanic(err)\n\t\t}\n\t}\n\n\timp := beam.Impulse(s)\n\tqueryParameters, err := encodeQueryParameters(queryOptions.parameters)\n\tif err != nil {\n\t\tpanic(errors.Wrapf(err, \"bigqueryio.Query: failed to encode query parameters\"))\n\t}\n\treturn beam.ParDo(\n\t\ts,\n\t\t&queryFn{Project: project, Query: query, Type: beam.EncodedType{T: t}, QueryParameters: queryParameters, Options: queryOptions},\n\t\timp,\n\t\tbeam.TypeDefinition{Var: beam.XType, T: t},\n\t)\n}\n\ntype queryFn struct {\n\t// Project is the project.","sourceCodeStart":136,"sourceCodeEnd":172,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/go/pkg/beam/io/bigqueryio/bigquery.go#L136-L172","documentation":"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.","triggerScenarios":"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.","commonSituations":"Passing unsupported Go types as query parameters (arrays, structs) to WithQueryParameter, or a custom option rejecting conflicting settings.","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."],"exampleFix":"// before\nbigqueryio.Query(s, project, q, t, bigqueryio.WithQueryParameter(\"ids\", []myStruct{...})) // option returns error\n// after\nbigqueryio.Query(s, project, q, t, bigqueryio.WithQueryParameter(\"ids\", []int64{1, 2, 3}))","handlingStrategy":"validation","validationCode":"for _, opt := range options {\n    tmp := bigqueryio.QueryOptions{}\n    if err := opt(&tmp); err != nil {\n        return err\n    }\n}","typeGuard":null,"tryCatchPattern":"func safeQuery(s beam.Scope, proj, q string, t reflect.Type, opts ...func(*bigqueryio.QueryOptions) error) (pc beam.PCollection, err error) {\n    defer func() {\n        if r := recover(); r != nil {\n            err = fmt.Errorf(\"bigqueryio.Query failed: %v\", r)\n        }\n    }()\n    return bigqueryio.Query(s, proj, q, t, opts...), nil\n}","preventionTips":["Pre-validate option values before passing them to bigqueryio.Query.","Use only supported scalar types for query parameters."],"tags":["go","apache-beam","bigquery"],"backgroundTag":"invalid-argument-value","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"}