{"record":{"id":"dabf1c038e743adf","repo":"gastownhall/beads","slug":"create-actor-and-issue-are-required","errorCode":null,"errorMessage":"create: actor and issue are required","messagePattern":"create: actor and issue are required","errorType":"validation","errorClass":"publicCreateValidationError","httpStatus":null,"severity":"error","filePath":"internal/storage/issueops/public_create.go","lineNumber":29,"sourceCode":"\t\"github.com/steveyegge/beads/internal/storage/domain\"\n\t\"github.com/steveyegge/beads/internal/types\"\n\tpublicops \"github.com/steveyegge/beads/issueops\"\n)\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 {","sourceCodeStart":11,"sourceCodeEnd":47,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/internal/storage/issueops/public_create.go#L11-L47","documentation":"ValidatePublicCreateRequest requires a create request to carry both a non-empty Actor and a non-nil Issue. Without them nothing meaningful can be created, so the request is rejected with a wrapped validation error (publicCreateValidationError) before any database work or unit-of-work is opened.","triggerScenarios":"Calling ExecuteCreate or PreparePublicCreateRequest with CreateRequest{Actor: \"\"} or CreateRequest{Issue: nil}.","commonSituations":"Unset actor from missing config/env; constructing the request where the Issue struct is conditionally built and ends up nil; a CLI path where neither --actor nor issue JSON was supplied.","solutions":["Set request.Actor to the acting identity and request.Issue to a non-nil *types.Issue before calling","Fail fast in the CLI layer with usage guidance when actor or issue payload is absent","Trim the actor and check Issue != nil in caller code before building the request"],"exampleFix":"// before\nreq := publicops.CreateRequest{Actor: actor} // Issue never set\n// after\nif issue == nil || actor == \"\" {\n    return fmt.Errorf(\"create requires an actor and an issue\")\n}\nreq := publicops.CreateRequest{Actor: actor, Issue: issue}","handlingStrategy":"validation","validationCode":"func createRequestOK(r publicops.CreateRequest) bool { return r.Actor != \"\" && r.Issue != nil }","typeGuard":null,"tryCatchPattern":"if err != nil {\n  var valErr *storage.ValidationError\n  if errors.As(err, &valErr) || errors.Is(err, storage.ErrValidation) {\n    return fmt.Errorf(\"bad create request: %w\", err)\n  }\n  return err\n}","preventionTips":["Build CreateRequest values through a helper that asserts Actor and Issue are set","Guard CLI paths where issue JSON may fail to parse into a nil Issue","Never construct CreateRequest with a bare struct literal missing Issue"],"tags":["create","validation","storage"],"backgroundTag":"missing-required-field","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}