gastownhall/beads · error

failed to get wisp dependencies with metadata

Error message

failed to get wisp dependencies with metadata: %w

What it means

This error wraps failure of the query 'SELECT <target> AS depends_on_id, type FROM wisp_dependencies WHERE issue_id = ?' in getWispDependenciesWithMetadata (exposed via GetDependenciesWithMetadata). It marks that dependency rows with their type metadata could not be fetched.

Solutions

  1. Inspect the wrapped driver error for the precise cause (missing column vs connection).
  2. Run schema migration/verification (bd doctor) so wisp_dependencies has the expected columns.
  3. Restore Dolt connectivity and retry.
  4. Re-create the .beads database from sync if corruption is indicated.
Defensive patterns

Strategy: try-catch

Validate before calling

// verify column exists: SHOW COLUMNS FROM wisp_dependencies LIKE 'type'

Try / catch

meta, err := GetDependenciesWithMetadata(ctx, id)
if err != nil {
    if strings.Contains(err.Error(), "Unknown column") {
        return migrateSchema(ctx) // older schema: run migration then retry
    }
    return err
}

Prevention

When it happens

Trigger: Calling GetDependenciesWithMetadata on a wisp when the connection fails, wisp_dependencies is missing, or the type column is absent (older schema) making the SELECT invalid.

Common situations: Schema upgraded/created before the type column existed; Dolt server unavailable; corrupted database file.

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/08c1079a62d895be. Report an issue: GitHub.

Appendix: source

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

	_ = rows.Close()
	if err := rows.Err(); err != nil {
		return nil, wrapQueryError("iterate wisp dependents", err)
	}

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

	return s.GetIssuesByIDs(ctx, ids)
}

// getWispDependenciesWithMetadata returns wisp dependencies with metadata.
func (s *DoltStore) getWispDependenciesWithMetadata(ctx context.Context, issueID string) ([]*types.IssueWithDependencyMetadata, error) {
	rows, err := s.queryContext(ctx, fmt.Sprintf(`
		SELECT %s AS depends_on_id, type FROM wisp_dependencies WHERE issue_id = ?
	`, issueops.DepTargetExpr), issueID)
	if err != nil {
		return nil, fmt.Errorf("failed to get wisp dependencies with metadata: %w", err)
	}

	type depMeta struct {
		depID, depType string
	}
	var deps []depMeta
	for rows.Next() {
		var depID, depType string
		if err := rows.Scan(&depID, &depType); err != nil {
			_ = rows.Close()
			return nil, wrapScanError("scan wisp dependency metadata", err)
		}
		deps = append(deps, depMeta{depID: depID, depType: depType})
	}
	_ = rows.Close()
	if err := rows.Err(); err != nil {
		return nil, wrapQueryError("iterate wisp dependencies", err)
	}

View on GitHub (pinned to 71377f2769)