gastownhall/beads · error
database %s has no child data sources
Error message
database %s has no child data sources
What it means
When the reference resolves as a database, ResolveDataSourceReference expects db.DataSources to contain at least one entry with a non-empty ID so it can fetch the child data source. A database with an empty/missing data_sources list triggers this error.
Source
Thrown at internal/notion/client.go:227
}
identifier := ExtractNotionIdentifier(ref)
if identifier == "" {
return nil, fmt.Errorf("could not extract a Notion ID from %q", ref)
}
if ds, err := client.RetrieveDataSource(ctx, identifier); err == nil {
return &ResolvedDataSource{
InputID: identifier,
DataSourceID: ds.ID,
DataSource: ds,
ViewURL: strings.TrimSpace(ref),
}, nil
} else {
db, dbErr := client.RetrieveDatabase(ctx, identifier)
if dbErr != nil {
return nil, fmt.Errorf("resolve %q as data source: %w; as database: %v", ref, err, dbErr)
}
if len(db.DataSources) == 0 || strings.TrimSpace(db.DataSources[0].ID) == "" {
return nil, fmt.Errorf("database %s has no child data sources", db.ID)
}
resolvedID := strings.TrimSpace(db.DataSources[0].ID)
resolvedDS, err := client.RetrieveDataSource(ctx, resolvedID)
if err != nil {
return nil, fmt.Errorf("retrieve child data source %s: %w", resolvedID, err)
}
return &ResolvedDataSource{
InputID: identifier,
DataSourceID: resolvedID,
DataSource: resolvedDS,
Database: db,
ViewURL: strings.TrimSpace(ref),
}, nil
}
}
func (c *Client) doRequest(ctx context.Context, method, path string, requestBody interface{}) ([]byte, error) {
if c == nil {View on GitHub (pinned to 71377f2769)
Solutions
- Raise the Notion-Version header to one that populates data_sources on database responses (2025+ versions).
- Upgrade the notion client library so Database parsing includes data_sources.
- Reference the data source URL directly instead of going through the database fallback.
- Confirm the referenced object is a database and not a plain page whose stub response lacks data_sources.
Example fix
// before
req.Header.Set("Notion-Version", "2022-06-28")
// after
req.Header.Set("Notion-Version", "2025-09-03") // data_sources populated on databases Defensive patterns
Strategy: validation
Validate before calling
db, err := client.RetrieveDatabase(ctx, id)
if err == nil && (db == nil || len(db.DataSources) == 0) {
return fmt.Errorf("database %s exposes no data sources; update Notion-Version", id)
} Prevention
- Use a Notion-Version that populates data_sources (2025+)
- Keep the client library current
- Prefer referencing the data source URL directly
- Beware cached/mocked database responses lacking data_sources
When it happens
Trigger: Calling ResolveDataSourceReference with a legacy database ID whose RetrieveDatabase response contains no data_sources array (pre data-source-model API version), or a database object returned with data_sources omitted by the pinned Notion-Version.
Common situations: Pinning an old Notion-Version header that predates the data_sources field; referencing an old-style database from before the 2025 API migration; a mock server or cached response lacking the field.
Related errors
- target is missing required Notion properties: %s
- resolve %q as data source: %w; as database: %v
- retrieve child data source %s: %w
- pidfile: legacy schema
- clone from %s succeeded, but the database needs %d schema %s
AI-assisted analysis of gastownhall/beads@71377f2769 (2026-08-30).
Data as JSON: /api/errors/f7b4d17cc533d0b9.
Report an issue: GitHub.