{"record":{"id":"e066710623b282dd","repo":"apache/beam","slug":"table-name-has-empty-components-v","errorCode":null,"errorMessage":"table name has empty components: %v","messagePattern":"table name has empty components: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdks/go/pkg/beam/io/bigqueryio/bigquery.go","lineNumber":83,"sourceCode":"\n// String formats the qualified name as \"<project>:<dataset>.<table>\".\nfunc (qn QualifiedTableName) String() string {\n\treturn fmt.Sprintf(\"%v:%v.%v\", qn.Project, qn.Dataset, qn.Table)\n}\n\n// NewQualifiedTableName parses \"<project>:<dataset>.<table>\" into a QualifiedTableName.\nfunc NewQualifiedTableName(s string) (QualifiedTableName, error) {\n\tc := strings.LastIndex(s, \":\")\n\td := strings.LastIndex(s, \".\")\n\tif c == -1 || d == -1 || d < c {\n\t\treturn QualifiedTableName{}, errors.Errorf(\"table name missing components: %v\", s)\n\t}\n\n\tproject := s[:c]\n\tdataset := s[c+1 : d]\n\ttable := s[d+1:]\n\tif strings.TrimSpace(project) == \"\" || strings.TrimSpace(dataset) == \"\" || strings.TrimSpace(table) == \"\" {\n\t\treturn QualifiedTableName{}, errors.Errorf(\"table name has empty components: %v\", s)\n\t}\n\treturn QualifiedTableName{Project: project, Dataset: dataset, Table: table}, nil\n}\n\n// Read reads all rows from the given table. The table must have a schema\n// compatible with the given type, t, and Read returns a PCollection<t>. If the\n// table has more rows than t, then Read is implicitly a projection.\nfunc Read(s beam.Scope, project, table string, t reflect.Type) beam.PCollection {\n\tmustParseTable(table)\n\n\ts = s.Scope(\"bigquery.Read\")\n\n\tstmt := constructSelectStatement(t, bigQueryTag, table)\n\n\treturn query(s, project, stmt, t)\n}\n\nfunc constructSelectStatement(t reflect.Type, tagKey string, table string) string {","sourceCodeStart":65,"sourceCodeEnd":101,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/go/pkg/beam/io/bigqueryio/bigquery.go#L65-L101","documentation":"After splitting \"<project>:<dataset>.<table>\", NewQualifiedTableName checks that none of the three components is empty or whitespace-only; if any is, it returns \"table name has empty components\" with the original string. The separators exist but the name still has blank project, dataset, or table parts.","triggerScenarios":"Passing strings like \":dataset.table\", \"project:.table\", \"project:dataset.\", or strings with only whitespace in one segment to NewQualifiedTableName.","commonSituations":"Template/variable interpolation leaving empty placeholders (e.g. fmt.Sprintf(\"%s:%s.%s\", p, d, t) with an unset variable), or trailing/leading whitespace around config values.","solutions":["Fill in the missing project, dataset, or table component at the reported position.","strings.TrimSpace the input before parsing and reject empty config values earlier.","Log the raw string from the error and validate the format with a regex like ^[^:]+:[^.]+\\.[^.]+$ at config load time.","Set defaults for unset project/dataset variables before constructing the name."],"exampleFix":"// before\ntable := cfg.Dataset + \".\" + cfg.Table // project empty\nqtn, _ := bigqueryio.NewQualifiedTableName(\":\" + table)\n// after\nif cfg.Project == \"\" || cfg.Dataset == \"\" || cfg.Table == \"\" {\n    return errors.New(\"project, dataset and table must all be set\")\n}\nqtn, err := bigqueryio.NewQualifiedTableName(fmt.Sprintf(\"%s:%s.%s\", cfg.Project, cfg.Dataset, cfg.Table))","handlingStrategy":"validation","validationCode":"parts := strings.SplitN(strings.TrimSpace(ref), \":\", 2)\nif len(parts) != 2 || strings.TrimSpace(parts[0]) == \"\" {\n    return fmt.Errorf(\"project component empty in %q\", ref)\n}","typeGuard":null,"tryCatchPattern":"qtn, err := bigqueryio.NewQualifiedTableName(ref)\nif err != nil && strings.Contains(err.Error(), \"empty components\") {\n    return fmt.Errorf(\"fill in missing project/dataset/table in %q\", ref)\n}","preventionTips":["TrimSpace config values before constructing table names","Fail fast on empty project/dataset/table variables at startup","Avoid template interpolation that can leave blank segments"],"tags":["bigquery","parsing","validation","beam-io"],"backgroundTag":"empty-required-field","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"}