{"record":{"id":"396532f0039a87c0","repo":"apache/beam","slug":"v-requires-either-a-table-or-query-specified-received-none","errorCode":null,"errorMessage":"%v requires either a Table or Query specified, received none","messagePattern":"(.+?) requires either a Table or Query specified, received none","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdks/go/pkg/beam/io/xlang/bigqueryio/bigquery.go","lineNumber":152,"sourceCode":"// within Read's function signature.\n//\n// Example:\n//\n//\texpansionAddr := \"localhost:1234\"\n//\ttable := \"project_id:dataset_id.table_id\"\n//\toutType := reflect.TypeOf((*Foo)(nil)).Elem()\n//\tpcol := bigqueryio.Read(s, outType,\n//\t    bigqueryio.FromTable(table),\n//\t    bigqueryio.ReadExpansionAddr(expansionAddr))\nfunc Read(s beam.Scope, elmT reflect.Type, opts ...readOption) beam.PCollection {\n\ts = s.Scope(\"bigqueryio.Read\")\n\n\trc := readConfig{cfg: &bigQueryConfig{}}\n\tfor _, opt := range opts {\n\t\topt(&rc)\n\t}\n\tif rc.cfg.Table == nil && rc.cfg.Query == nil {\n\t\tpanic(fmt.Sprintf(\"%v requires either a Table or Query specified, received none\", s.String()))\n\t}\n\n\taddr := rc.addr\n\tif addr == \"\" {\n\t\taddr = autoStartupAddress\n\t}\n\n\tpl := schemaio.MustEncodePayload(\"\", rc.cfg, nil)\n\toutT := typex.New(elmT)\n\touts := beam.CrossLanguage(s, readURN, pl, addr, nil, beam.UnnamedOutput(outT))\n\treturn outs[beam.UnnamedOutputTag()]\n}\n\ntype readConfig struct {\n\tcfg  *bigQueryConfig\n\taddr string\n}\ntype readOption func(*readConfig)","sourceCodeStart":134,"sourceCodeEnd":170,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/go/pkg/beam/io/xlang/bigqueryio/bigquery.go#L134-L170","documentation":"bigqueryio.Read in the Beam Go xlang package panics if neither a Table nor a Query option was supplied. The cross-language BigQuery read needs exactly one of these to know what data to fetch, so an empty configuration is rejected at graph-construction time.","triggerScenarios":"Calling bigqueryio.Read(s, addr) with no bigqueryio.Table(...) or bigqueryio.Query(...) option in the variadic opts list.","commonSituations":"Building read options conditionally where both branches were skipped; refactoring away from a positional table argument into options and forgetting to add one; constructing options from config where the table/query key was absent.","solutions":["Pass either bigqueryio.Table(\"project:dataset.table\") or bigqueryio.Query(\"SELECT ...\") as an option.","If the source is chosen dynamically, validate exactly one is set before calling Read and return a clear error instead.","Check that your config-loading code actually populates the table or query value (non-empty string)."],"exampleFix":"// before\nbigqueryio.Read(s, addr)\n// after\nbigqueryio.Read(s, addr, bigqueryio.Table(\"my-project:mydataset.mytable\"))","handlingStrategy":"validation","validationCode":"func hasBQSource(opts []bigqueryio.ReadOption, table, query string) error {\n    if table == \"\" && query == \"\" {\n        return errors.New(\"bigqueryio.Read needs either a Table or a Query\")\n    }\n    return nil\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pass exactly one of Table or Query to Read.","Centralize BigQuery source resolution in one helper that guarantees one is set.","Fail with a clear error in your config loader when both table and query are empty."],"tags":["go","apache-beam","bigquery","missing-argument","panic"],"backgroundTag":"missing-required-argument","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"}