{"record":{"id":"d6c537cd1f6369c3","repo":"gastownhall/beads","slug":"create-w","errorCode":null,"errorMessage":"create: %w","messagePattern":"create: %w","errorType":"validation","errorClass":"publicCreateValidationError","httpStatus":null,"severity":"error","filePath":"internal/storage/issueops/public_create.go","lineNumber":32,"sourceCode":")\n\n// PublicCreateContext holds the configuration required to prepare a public\n// create request for the domain create use case.\ntype PublicCreateContext struct {\n\tIssuePrefix     string\n\tAllowedPrefixes string\n\tCustomStatuses  []string\n\tCustomTypes     []string\n}\n\n// ValidatePublicCreateRequest checks public-create invariants independent of\n// database configuration.\nfunc ValidatePublicCreateRequest(request publicops.CreateRequest) error {\n\tif request.Actor == \"\" || request.Issue == nil {\n\t\treturn publicCreateValidationError(fmt.Errorf(\"create: actor and issue are required\"))\n\t}\n\tif err := types.CheckFieldLen(\"actor\", request.Actor); err != nil {\n\t\treturn publicCreateValidationError(fmt.Errorf(\"create: %w\", err))\n\t}\n\tif len(request.Issue.Comments) > 0 || len(request.Issue.Dependencies) > 0 {\n\t\treturn publicCreateValidationError(fmt.Errorf(\"create: issue comments and dependencies must be supplied through request fields\"))\n\t}\n\tfor _, field := range []struct{ name, value string }{{\"assignee\", request.Issue.Assignee}, {\"owner\", request.Issue.Owner}} {\n\t\tif err := types.CheckFieldLen(field.name, field.value); err != nil {\n\t\t\treturn publicCreateValidationError(err)\n\t\t}\n\t}\n\tfor _, label := range request.Issue.Labels {\n\t\tif err := types.CheckFieldLen(\"label\", label); err != nil {\n\t\t\treturn publicCreateValidationError(err)\n\t\t}\n\t}\n\tif err := types.CheckFieldLen(\"parent ID\", request.ParentID); err != nil {\n\t\treturn publicCreateValidationError(fmt.Errorf(\"create: %w\", err))\n\t}\n\treturn validatePublicCreateDependencies(request)","sourceCodeStart":14,"sourceCodeEnd":50,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/internal/storage/issueops/public_create.go#L14-L50","documentation":"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.","triggerScenarios":"Calling ExecuteCreate/PreparePublicCreateRequest where Actor, Issue.Assignee, or Issue.Owner exceeds the maximum length enforced by types.CheckFieldLen.","commonSituations":"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.","solutions":["Truncate or correct the offending field to satisfy the length limit before building the request","Check lengths client-side (len(actor), len(assignee), len(owner)) against the types.CheckFieldLen limits and report which field is too long","Unwrap the returned error to see the underlying types.ErrFieldTooLong message naming the exact field"],"exampleFix":"// before\nreq := publicops.CreateRequest{Actor: veryLongActor, Issue: issue}\n// after\nactor := veryLongActor\nif len(actor) > types.MaxActorLen {\n    return fmt.Errorf(\"actor exceeds %d chars\", types.MaxActorLen)\n}\nreq := publicops.CreateRequest{Actor: actor, Issue: issue}","handlingStrategy":"validation","validationCode":"if len(actor) > types.MaxActorLen || len(issue.Assignee) > types.MaxFieldLen || len(issue.Owner) > types.MaxFieldLen {\n  return errors.New(\"actor/assignee/owner exceeds length limit\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Enforce length limits at input-collection time (CLI flags, form fields)","Unwrap the returned error to identify the exact field via types.ErrFieldTooLong","Keep identities short; avoid concatenating long prefixes into actor strings"],"tags":["create","validation","field-length"],"backgroundTag":"field-too-long","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}