gastownhall/beads · error

adding comment

Error message

adding comment: %w

What it means

Error "adding comment: %w" thrown in gastownhall/beads.

Solutions

  1. Check the wrapped error for the underlying storage failure and fix it
  2. Retry the comment submission after the cause is resolved
Defensive patterns

Strategy: try-catch

Validate before calling

// resolve target first so storage failures are separated from write failures
bd show "$ID" >/dev/null || exit 1

Try / catch

if ! bd comment "$ID" --text "$T"; then
  echo "comment add failed; check server health and issue state"
fi

Prevention

When it happens

Trigger: Thrown at cmd/bd/comments_proxied_server.go:140 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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

Appendix: source

Thrown at cmd/bd/comments_proxied_server.go:140

// result type carrying presentation for one front door is a result type that
// grows one field per front door. The role is handed the canonical id the
// pre-flight resolved, exactly as `bd show` hands Reader.Get one.
func addCommentProxied(ctx context.Context, id, author, text string) (*types.Comment, *types.Issue, error) {
	issue, err := resolveCommentTargetProxied(ctx, id)
	if err != nil {
		return nil, nil, err
	}
	commenter, err := proxiedCommenter()
	if err != nil {
		return nil, nil, err
	}
	result, err := commenter.AddComment(ctx, issueops.AddCommentRequest{
		Author:  author,
		IssueID: issue.ID,
		Text:    text,
	})
	if err != nil {
		return nil, nil, fmt.Errorf("adding comment: %w", err)
	}
	return result.Comment, issue, nil
}

// resolveCommentTargetProxied resolves the anchor and applies the CLI's own
// pre-flight policy. It reads in a unit of work of its own and writes nothing,
// so the role's request stays the whole of the transaction.
func resolveCommentTargetProxied(ctx context.Context, id string) (*types.Issue, error) {
	uw, err := proxiedOpenReadUOW(ctx)
	if err != nil {
		return nil, err
	}
	defer uw.Close(ctx)

	issue, _, err := workapi.GetIssueOrWisp(ctx, workapi.NewUOWDetailSource(uw), id)
	if errors.Is(err, storage.ErrNotFound) {
		return nil, fmt.Errorf("issue %s not found", id)
	}

View on GitHub (pinned to 71377f2769)