{"record":{"id":"a10566944f5eac76","repo":"apache/beam","slug":"table-does-not-exist-and-create-disposition-is-createnever-v","errorCode":null,"errorMessage":"table does not exist and create disposition is 'CreateNever': %v","messagePattern":"table does not exist and create disposition is 'CreateNever': (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdks/go/pkg/beam/io/bigqueryio/bigquery.go","lineNumber":363,"sourceCode":"\t\treturn err\n\t}\n\tdefer client.Close()\n\n\t// TODO(herohde) 7/14/2017: should we create datasets? For now, \"no\".\n\n\tdataset := client.DatasetInProject(f.Table.Project, f.Table.Dataset)\n\tif _, err := dataset.Metadata(ctx); err != nil {\n\t\treturn err\n\t}\n\n\tschema := mustInferSchema(f.Type.T)\n\ttable := dataset.Table(f.Table.Table)\n\tif _, err := table.Metadata(ctx); err != nil {\n\t\tif !isNotFound(err) {\n\t\t\treturn err\n\t\t}\n\t\tif f.Options.CreateDisposition == bigquery.CreateNever {\n\t\t\treturn fmt.Errorf(\"table does not exist and create disposition is 'CreateNever': %v\", err)\n\t\t}\n\t\tif err := table.Create(ctx, &bigquery.TableMetadata{Schema: schema}); err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tvar data []reflect.Value\n\t// This stores the running byte size estimate of a BQ request.\n\tsize := writeOverheadBytes\n\n\tvar val beam.X\n\tfor iter(&val) {\n\t\tcurrent, err := getInsertSize(val.(any), schema)\n\t\tif err != nil {\n\t\t\treturn errors.Wrapf(err, \"bigquery write error\")\n\t\t}\n\t\tif len(data)+1 > writeRowLimit || size+current > writeSizeLimit {\n\t\t\t// Write rows in batches to comply with BQ limits.","sourceCodeStart":345,"sourceCodeEnd":381,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/go/pkg/beam/io/bigqueryio/bigquery.go#L345-L381","documentation":"When writing to BigQuery with a CreateDisposition of CreateNever, Beam checks whether the destination table exists. If the table metadata lookup returns NotFound and creation is disallowed, this error is thrown because the write cannot proceed.","triggerScenarios":"Running bigqueryio.Write (or WriteWithSchema) with Options.CreateDisposition == bigquery.CreateNever while the destination table does not exist in the dataset.","commonSituations":"Typo in table name or dataset; writing to a different project than intended; table deleted before the job ran; forgetting the default CreateDisposition (CREATE_IF_NEEDED).","solutions":["Set CreateDisposition to bigquery.CREATE_IF_NEEDED so Beam creates the table from the schema.","Create the table manually in BigQuery with the expected schema before running the pipeline.","Verify the table/dataset/project names are correct and that credentials can see the table."],"exampleFix":"// before\nbq.Write(s, project, \"dataset.table\", elems)\n// after\nopts := bq.WriteOptions{CreateDisposition: bigquery.CreateIfNeeded}\nbq.WriteWithSchema(s, project, \"dataset.table\", schema, elems, opts)","handlingStrategy":"validation","validationCode":"client, _ := bigquery.NewClient(ctx, projectID)\ntable := client.Dataset(dataset).Table(tableID)\nif _, err := table.Metadata(ctx); err != nil && createDisposition == bigquery.CreateNever {\n    return fmt.Errorf(\"destination table %s.%s missing and CreateNever set\", dataset, tableID)\n}","typeGuard":null,"tryCatchPattern":"if err := beamJob.Run(ctx); err != nil && strings.Contains(err.Error(), \"CreateNever\") {\n    // create table or switch disposition and retry\n}","preventionTips":["Verify destination tables exist (or use CREATE_IF_NEEDED) before launching jobs.","Validate table names against the target project at pipeline-construction time."],"tags":["bigquery","gcp","beam","go"],"backgroundTag":"resource-not-found","analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-14T21:17:11.552Z"}