gastownhall/beads · error

Notion create database response did not include a child data

Error message

Notion create database response did not include a child data source

What it means

During `bd notion init`, bd calls the Notion API to create a database under the given parent and expects the response to contain at least one child data source with a non-empty ID. If Notion returns a database without usable data sources (API version drift, unexpected response shape), bd cannot configure notion.data_source_id and fails with this error.

Source

Thrown at cmd/bd/notion.go:660

	}

	for _, raw := range issue.Labels {
		label := strings.ToLower(strings.TrimSpace(raw))
		if _, ok := configured[label]; ok {
			return true
		}
	}

	return false
}

func runNotionInitAfterValidation(ctx context.Context, client *notion.Client, parent, title string, setter notionConfigSetter, deleter notionConfigDeleter) (notionSetupResult, error) {
	db, err := client.CreateDatabase(ctx, parent, title)
	if err != nil {
		return notionSetupResult{}, err
	}
	if len(db.DataSources) == 0 || strings.TrimSpace(db.DataSources[0].ID) == "" {
		return notionSetupResult{}, fmt.Errorf("Notion create database response did not include a child data source")
	}
	result := notionSetupResult{
		Action:       "init",
		DatabaseID:   strings.TrimSpace(db.ID),
		DataSourceID: strings.TrimSpace(db.DataSources[0].ID),
		ViewURL:      strings.TrimSpace(db.URL),
		Message:      "Notion target initialized",
	}
	if err := saveNotionTargetConfigWithWriter(ctx, setter, deleter, result.DataSourceID, result.ViewURL); err != nil {
		return notionSetupResult{}, err
	}
	return result, nil
}

func runNotionConnectAfterValidation(ctx context.Context, client *notion.Client, url string, setter notionConfigSetter, deleter notionConfigDeleter) (notionSetupResult, error) {
	resolved, err := notion.ResolveDataSourceReference(ctx, client, url)
	if err != nil {
		return notionSetupResult{}, err

View on GitHub (pinned to 71377f2769)

Solutions

  1. Retry `bd notion init` — data source provisioning on Notion's side can be transient.
  2. Update bd to the latest version so the Notion client matches current API response shapes.
  3. Check Notion status/incidents; retry later if Notion is degraded.
  4. As a workaround, create/locate the database manually and use `bd notion connect --url <notion-url>` instead.
Defensive patterns

Strategy: retry

Try / catch

result, err := runNotionInit(cmd, args)
if err != nil && strings.Contains(err.Error(), "did not include a child data source") {
    // transient/provisioning issue: back off and retry init once
    time.Sleep(2 * time.Second)
    return runNotionInit(cmd, args)
}

Prevention

When it happens

Trigger: runNotionInitAfterValidation calls client.CreateDatabase and receives a response where db.DataSources is empty or DataSources[0].ID is blank/whitespace.

Common situations: Notion API behavior/version change returning a new database whose data sources are provisioned asynchronously; Notion incident/partial response; API client out of date relative to Notion's current response schema.

Related errors


AI-assisted analysis of gastownhall/beads@71377f2769 (2026-08-30). Data as JSON: /api/errors/bcf69c48ae3d98cb. Report an issue: GitHub.