gastownhall/beads · error

ErrDependentsOutsideRequest

ErrDependentsOutsideRequest

Error message

dependents outside deletion set

What it means

ErrDependentsOutsideRequest is returned by the deleter when a delete request would remove an issue that has dependents the request did not name, and neither Cascade nor Force said what to do. DependentsOutsideRequestError wraps the sentinel and reports which row was blocked and by what, naming one blocked row (the first the implementation reached). It lives in issueops/deleter.go because it is meaningless without DeleteRequest.Cascade/Force.

Source

Thrown at issueops/deleter.go:203

	// It is populated exactly when the request carried Force without Cascade —
	// the only mode in which orphaning is possible — and is empty otherwise.
	// It is also carried on the DependentsOutsideRequestError the unforced
	// mode returns, so the same fact reaches a caller whichever answer it got.
	//
	// It is DIRECT dependents only. A row two edges away loses no edge and is
	// not orphaned by this deletion; it is merely blocked by something that is
	// now blocked by nothing.
	Orphaned []string
}

// ErrDependentsOutsideRequest classifies the unforced refusal: a named row has
// a dependent the request did not name, and neither Cascade nor Force said
// what to do about it.
//
// It lives beside the role rather than in errors.go because it is meaningless
// without DeleteRequest.Cascade and DeleteRequest.Force to explain it, and
// errors.go is the file every parallel role slice touches.
var ErrDependentsOutsideRequest = errors.New("dependents outside deletion set")

// DependentsOutsideRequestError reports WHICH row was blocked and by WHAT, so
// a caller can name them without parsing the message. It wraps the sentinel
// rather than replacing it.
//
// It names ONE blocked row — the first the implementation reached — rather
// than every blocked row in the request. That is deliberate and matches the
// only answer a caller can act on: the request is refused whole, so the second
// blocked row changes nothing about what to do next, and enumerating all of
// them would cost a full scan on the path that deletes nothing.
type DependentsOutsideRequestError struct {
	// IssueID is the named row that has dependents outside the request.
	IssueID string
	// Dependents are that row's direct dependents that the request did not
	// name, in ascending id order.
	Dependents []string
}

View on GitHub (pinned to 71377f2769)

Solutions

  1. Inspect DependentsOutsideRequestError to see the blocked row and its dependents, then include those dependents in the request or delete them first.
  2. Set DeleteRequest.Cascade = true to delete dependents along with the target.
  3. Set DeleteRequest.Force = true to deliberately ignore unmanaged dependents.
  4. Query dependencies before deleting and build a complete deletion set.

Example fix

// before
err := deleter.Delete(ctx, types.DeleteRequest{Issues: []string{"bd-5"}}) // blocked

// after
err := deleter.Delete(ctx, types.DeleteRequest{Issues: []string{"bd-5"}, Cascade: true})
// or inspect err.(*issueops.DependentsOutsideRequestError) to name the blockers
Defensive patterns

Strategy: validation

Validate before calling

deps, _ := store.GetDependents(ctx, targetID)
if len(deps) > 0 && !req.Cascade && !req.Force {
    // expand request or set Cascade/Force before deleting
}

Type guard

var d *issueops.DependentsOutsideRequestError
if errors.As(err, &d) {
    // d names the blocked row and its dependents
}

Try / catch

if errors.Is(err, issueops.ErrDependentsOutsideRequest) {
    var d *issueops.DependentsOutsideRequestError
    errors.As(err, &d) // name the row/dependents to the user
}

Prevention

When it happens

Trigger: Calling the deleter (RunDeleter paths, failDeleteErr) with a DeleteRequest that omits Cascade and Force while the target issue has dependents not included in the request; deleting a parent whose children were not named.

Common situations: Deleting a parent issue without realizing it has open children; batch cleanup scripts that delete leaves' parents; refactors that re-parent issues leaving stale dependents.

Related errors


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