gastownhall/beads · error

get dependency counts: dependent rows: %w

Error message

get dependency counts: dependent rows: %w

What it means

Returned by GetDependencyCountsInTx after finishing iteration of the 'dependents counts' result set when rows.Err() reports a driver-level failure during iteration (connection loss, cancellation, server error). Equivalent to the blocker-rows variant but on the inbound (dependents) query.

Source

Thrown at internal/storage/issueops/dependency_queries.go:518

				if optionalBlockedTable(depTable) && isTableNotExistError(err) {
					continue
				}
				return nil, fmt.Errorf("get dependency counts (dependents from %s): %w", depTable, err)
			}
			for blockingRows.Next() {
				var id string
				var cnt int
				if err := blockingRows.Scan(&id, &cnt); err != nil {
					_ = blockingRows.Close()
					return nil, fmt.Errorf("get dependency counts: scan dependent: %w", err)
				}
				if c, ok := result[id]; ok {
					c.DependentCount += cnt
				}
			}
			_ = blockingRows.Close()
			if err := blockingRows.Err(); err != nil {
				return nil, fmt.Errorf("get dependency counts: dependent rows: %w", err)
			}
		}
	}

	return result, nil
}

// GetBlockingInfoForIssuesInTx returns blocking dependency records for a set of issue IDs.
// Returns three maps:
//   - blockedByMap: issueID -> list of IDs blocking it
//   - blocksMap: issueID -> list of IDs it blocks
//   - parentMap: childID -> parentID (parent-child deps)
func GetBlockingInfoForIssuesInTx(ctx context.Context, tx DBTX, issueIDs []string) (
	blockedByMap map[string][]string,
	blocksMap map[string][]string,
	parentMap map[string]string,
	err error,
) {

View on GitHub (pinned to 71377f2769)

Solutions

  1. Check the wrapped error: context cancellation means raise the timeout or reduce per-call work.
  2. Retry the call — iteration errors from transient network issues usually clear on re-run.
  3. Verify connectivity to the remote Dolt server (ping, server logs) and restart if it crashed.
  4. Split large ID lists into smaller calls to shorten each streamed result.
  5. If behind a proxy/LB, raise its idle timeout for long-running queries.

Example fix

// before: one giant call over a flaky link
result, err := GetDependencyCountsInTx(ctx, tx, thousandsOfIDs)

// after: bounded timeout + retry per chunk
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
defer cancel()
for _, chunk := range chunkIDs(thousandsOfIDs, 100) {
    if _, err := GetDependencyCountsInTx(ctx, tx, chunk); err != nil {
        if !isTransient(err) { return err }
        time.Sleep(backoff) // then retry chunk
    }
}
Defensive patterns

Strategy: retry

Validate before calling

// Go: check context and connectivity before the call
if ctx.Err() != nil {
    return ctx.Err()
}
if err := tx.PingContext(ctx); err != nil {
    return fmt.Errorf("database unreachable: %w", err)
}

Type guard

func isDependentRowsError(err error) bool {
    return err != nil && strings.Contains(err.Error(), "dependent rows")
}

Try / catch

counts, err := GetDependencyCountsInTx(ctx, tx, ids)
if isDependentRowsError(err) && isRetryable(err) {
    time.Sleep(exponentialBackoff(attempt))
    counts, err = GetDependencyCountsInTx(ctx, tx, ids)
}

Prevention

When it happens

Trigger: Calling GetDependencyCountsInTx when the database connection drops or the context is cancelled while streaming dependents counts from dependencies/wisp_dependencies, or the remote Dolt server fails mid-response.

Common situations: Network interruptions to remote backends; context deadlines on slow queries; Dolt server restarts; TLS/proxy idle timeouts cutting off long result streams.

Related errors


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