apache/beam · critical

no database provided

Error message

no database provided

What it means

newGeneratePartitionsFn panics when the database string is empty while building the partitioned-query DoFn. Like the rest of spannerio, partitioned reads require a fully qualified database path and treat a missing one as an immediate construction error.

Source

Thrown at sdks/go/pkg/beam/io/spannerio/generate_partitions.go:71

}

func partitionOptions(options queryOptions) spanner.PartitionOptions {
	partitionOptions := spanner.PartitionOptions{}

	if options.MaxPartitions != 0 {
		partitionOptions.MaxPartitions = options.MaxPartitions
	}

	return partitionOptions
}

func newGeneratePartitionsFn(
	db string,
	query string,
	options queryOptions,
) *generatePartitionsFn {
	if db == "" {
		panic("no database provided")
	}

	return &generatePartitionsFn{
		spannerFn: newSpannerFn(db),
		Query:     query,
		Options:   options,
	}
}

func (f *generatePartitionsFn) ProcessElement(ctx context.Context, _ []byte, emit func(partitionedRead)) error {
	txn, err := f.client.BatchReadOnlyTransaction(ctx, f.Options.TimestampBound)
	if err != nil {
		panic("unable to create batch read only transaction: " + err.Error())
	}
	defer txn.Close()

	mode := spannerpb.ExecuteSqlRequest_PROFILE

View on GitHub (pinned to 12126d8942)

Solutions

  1. Provide the full database path projects/<proj>/instances/<inst>/databases/<db>.
  2. Validate db != "" before invoking the generate-partitions API.
  3. Ensure the pipeline option/flag feeding the database is parsed and non-empty.

Example fix

// before
generatePartitions(s, "", query, opts)
// after
const db = "projects/my-proj/instances/my-inst/databases/my-db"
generatePartitions(s, db, query, opts)
Defensive patterns

Strategy: validation

Validate before calling

if db == "" {
    return errors.New("no database provided for generatePartitions")
}

Try / catch

defer func() {
    if r := recover(); r != nil {
        if s, ok := r.(string); ok && s == "no database provided" {
            // handle
        } else { panic(r) }
    }
}()

Prevention

When it happens

Trigger: Calling spannerio's partitioned-query entry point (generatePartitions path) with db == "".

Common situations: Empty Spanner database env var or pipeline option; constructing the DoFn in a test with placeholder arguments; refactoring that dropped the database parameter.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


AI-assisted analysis of apache/beam@12126d8942 (2026-09-13). Data as JSON: /api/errors/24139d404ee6f3cc. Report an issue: GitHub.