gastownhall/beads · error
get molecule children: %w
Error message
get molecule children: %w
What it means
GetMoleculeLastActivity wraps any failure from GetDependentsWithMetadata (the query fetching a molecule's child issues) with the 'get molecule children' prefix. It indicates the storage/query layer failed while enumerating dependent issues for the molecule, before last-activity computation could start. The underlying cause is preserved via %w so callers can errors.Is/As it.
Source
Thrown at cmd/bd/mol_port.go:300
}
stats.Total++
switch dependent.Status {
case types.StatusClosed:
stats.Completed++
case types.StatusInProgress:
stats.InProgress++
if stats.CurrentStepID == "" {
stats.CurrentStepID = dependent.ID
}
}
}
return stats, nil
}
func (r uowMolReader) GetMoleculeLastActivity(ctx context.Context, moleculeID string) (*types.MoleculeLastActivity, error) {
dependents, err := r.GetDependentsWithMetadata(ctx, moleculeID)
if err != nil {
return nil, fmt.Errorf("get molecule children: %w", err)
}
var children []types.Issue
for _, dependent := range dependents {
if dependent.DependencyType != types.DepParentChild {
continue
}
children = append(children, dependent.Issue)
}
if len(children) == 0 {
root, err := r.GetIssue(ctx, moleculeID)
if err != nil {
return nil, fmt.Errorf("molecule %s not found: %w", moleculeID, err)
}
return &types.MoleculeLastActivity{
MoleculeID: moleculeID,
LastActivity: root.UpdatedAt,View on GitHub (pinned to 71377f2769)
Solutions
- Inspect the wrapped cause (%w) with errors.Is/As or by reading the full error chain to find the storage-level failure
- Verify the local database is healthy (run bd doctor / re-open the repo; check .beads storage)
- Retry the command — transient locks or I/O failures often resolve on retry
- If the schema is out of date after a beads upgrade, run the project's upgrade/migration path (bd upgrade/migrate) before retrying
Example fix
// before: only seeing 'get molecule children: ...'
last, err := reader.GetMoleculeLastActivity(ctx, molID)
// after: unwrap and classify the root cause
last, err := reader.GetMoleculeLastActivity(ctx, molID)
if err != nil {
if errors.Is(err, sql.ErrConnDone) || errors.Is(err, context.DeadlineExceeded) {
last, err = reader.GetMoleculeLastActivity(ctx, molID) // retry transient
}
return fmt.Errorf("last activity: %w", err)
} Defensive patterns
Strategy: try-catch
Validate before calling
// verify the molecule's dependents are queryable first
if _, err := reader.GetDependentsWithMetadata(ctx, moleculeID); err != nil {
return fmt.Errorf("cannot read molecule %s: %w", moleculeID, err)
} Type guard
func isStorageErr(err error) bool {
return err != nil && !errors.Is(err, sql.ErrNoRows) && !errors.Is(err, context.Canceled)
} Try / catch
last, err := reader.GetMoleculeLastActivity(ctx, molID)
if err != nil {
var inner error
if errors.As(err, &inner) && isTransientStorage(inner) {
// retry once after backoff
}
return err
} Prevention
- Run bd doctor periodically to catch DB corruption early
- Wrap long molecule queries in a context with a sane timeout instead of relying on cancellation
- Keep the beads version and database schema in sync after upgrades
- Inspect the full wrapped error chain (%w) before guessing at causes
When it happens
Trigger: Calling bd mol last-activity (runMolLastActivityProxiedServer) when the database query for dependents fails: storage driver errors, corrupt or locked Dolt database, context cancellation/timeouts, or an internal error in the dependents-with-metadata query.
Common situations: Running the command against a corrupted or unavailable .beads/Dolt database; a killed or mid-migration local DB; a stale database schema after a beads version upgrade; transient storage I/O failure.
Understand the failure class
Background: Database query failed: Internal Server Error 500s wrapping SQL, Prisma, and connection failures — what to check first — this error's family across 16 libraries.
Related errors
- determining wisp status for %s: %w
- failed to get issue %s: %w
- failed to remove relates-to %s -> %s: %w
- failed to get epic: %v
- failed to get issue: %v
AI-assisted analysis of gastownhall/beads@71377f2769 (2026-08-30).
Data as JSON: /api/errors/5dd606e6deffc24d.
Report an issue: GitHub.