gastownhall/beads · error · publicCreateValidationError

create: %w

Error message

create: %w

What it means

This is the wrapper for field-length validation failures inside ValidatePublicCreateRequest. Any field that fails types.CheckFieldLen (e.g. "actor" too long, or assignee/owner over their limits) is re-wrapped as "create: %w" and returned as a public-create validation error.

Source

Thrown at internal/storage/issueops/public_create.go:32

)

// PublicCreateContext holds the configuration required to prepare a public
// create request for the domain create use case.
type PublicCreateContext struct {
	IssuePrefix     string
	AllowedPrefixes string
	CustomStatuses  []string
	CustomTypes     []string
}

// ValidatePublicCreateRequest checks public-create invariants independent of
// database configuration.
func ValidatePublicCreateRequest(request publicops.CreateRequest) error {
	if request.Actor == "" || request.Issue == nil {
		return publicCreateValidationError(fmt.Errorf("create: actor and issue are required"))
	}
	if err := types.CheckFieldLen("actor", request.Actor); err != nil {
		return publicCreateValidationError(fmt.Errorf("create: %w", err))
	}
	if len(request.Issue.Comments) > 0 || len(request.Issue.Dependencies) > 0 {
		return publicCreateValidationError(fmt.Errorf("create: issue comments and dependencies must be supplied through request fields"))
	}
	for _, field := range []struct{ name, value string }{{"assignee", request.Issue.Assignee}, {"owner", request.Issue.Owner}} {
		if err := types.CheckFieldLen(field.name, field.value); err != nil {
			return publicCreateValidationError(err)
		}
	}
	for _, label := range request.Issue.Labels {
		if err := types.CheckFieldLen("label", label); err != nil {
			return publicCreateValidationError(err)
		}
	}
	if err := types.CheckFieldLen("parent ID", request.ParentID); err != nil {
		return publicCreateValidationError(fmt.Errorf("create: %w", err))
	}
	return validatePublicCreateDependencies(request)

View on GitHub (pinned to 71377f2769)

Solutions

  1. Truncate or correct the offending field to satisfy the length limit before building the request
  2. Check lengths client-side (len(actor), len(assignee), len(owner)) against the types.CheckFieldLen limits and report which field is too long
  3. Unwrap the returned error to see the underlying types.ErrFieldTooLong message naming the exact field

Example fix

// before
req := publicops.CreateRequest{Actor: veryLongActor, Issue: issue}
// after
actor := veryLongActor
if len(actor) > types.MaxActorLen {
    return fmt.Errorf("actor exceeds %d chars", types.MaxActorLen)
}
req := publicops.CreateRequest{Actor: actor, Issue: issue}
Defensive patterns

Strategy: validation

Validate before calling

if len(actor) > types.MaxActorLen || len(issue.Assignee) > types.MaxFieldLen || len(issue.Owner) > types.MaxFieldLen {
  return errors.New("actor/assignee/owner exceeds length limit")
}

Prevention

When it happens

Trigger: Calling ExecuteCreate/PreparePublicCreateRequest where Actor, Issue.Assignee, or Issue.Owner exceeds the maximum length enforced by types.CheckFieldLen.

Common situations: Free-form user input pasted into assignee/owner fields; actor identities built by concatenating long email/username parts; data migrated from systems with looser limits.

Related errors


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