gastownhall/beads · error

failed to get wisp dependencies: %w

Error message

failed to get wisp dependencies: %w

What it means

This error wraps a failure of the query 'SELECT <target> FROM wisp_dependencies WHERE issue_id = ?' inside getWispDependencies. It indicates the dependencies-of-wisp lookup could not be executed; the library wraps the driver error to mark the failing query.

Source

Thrown at internal/storage/dolt/wisps.go:715

		SourceTable:   "wisps",
		WriteTable:    "wisp_dependencies",
		IsCrossPrefix: isCrossPrefix,
		TargetKind:    &kind,
		EmitEvent:     emitEvent,
	}); err != nil {
		return err
	}

	return s.commitSQLTx(ctx, "commit add wisp dependency", tx)
}

// getWispDependencies retrieves issues that a wisp depends on.
func (s *DoltStore) getWispDependencies(ctx context.Context, issueID string) ([]*types.Issue, error) {
	rows, err := s.queryContext(ctx, fmt.Sprintf(`
		SELECT %s AS depends_on_id FROM wisp_dependencies WHERE issue_id = ?
	`, issueops.DepTargetExpr), issueID)
	if err != nil {
		return nil, fmt.Errorf("failed to get wisp dependencies: %w", err)
	}

	var ids []string
	for rows.Next() {
		var id string
		if err := rows.Scan(&id); err != nil {
			_ = rows.Close()
			return nil, wrapScanError("scan wisp dependency", err)
		}
		ids = append(ids, id)
	}
	_ = rows.Close()
	if err := rows.Err(); err != nil {
		return nil, wrapQueryError("iterate wisp dependencies", err)
	}

	if len(ids) == 0 {
		return nil, nil

View on GitHub (pinned to 71377f2769)

Solutions

  1. Read the wrapped driver error for the root cause.
  2. Confirm the wisp_dependencies table exists and matches the current schema (re-run migrations / bd doctor).
  3. Restore connectivity to the Dolt database and retry.
  4. If DepTargetExpr changed, rebuild/reopen the store so the SQL matches the schema version.
Defensive patterns

Strategy: try-catch

Validate before calling

// ensure schema present before querying
// e.g. run: SELECT 1 FROM wisp_dependencies LIMIT 1

Try / catch

deps, err := getWispDependencies(ctx, id)
if err != nil {
    return fmt.Errorf("cannot load dependencies for %s: %w", id, err)
}

Prevention

When it happens

Trigger: Calling getWispDependencies (directly or via public dependency lookups) when the wisp_dependencies table is missing, the connection is broken, or the SQL fragment DepTargetExpr is incompatible with the current schema/engine.

Common situations: Schema drift after upgrading beads without migration; Dolt server unavailable; corrupted .beads database.

Understand the failure class

Background: "query failed", "%w: SQL error" — wrapped database query errors in Go libraries explained — this error's family across 3 libraries.

Related errors


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