{"record":{"id":"165ecb28c9e5b350","repo":"gastownhall/beads","slug":"create-issue-comments-and-dependencies-must-be-su","errorCode":null,"errorMessage":"create: issue comments and dependencies must be supplied through request fields","messagePattern":"create: issue comments and dependencies must be supplied through request fields","errorType":"validation","errorClass":"publicCreateValidationError","httpStatus":null,"severity":"error","filePath":"internal/storage/issueops/public_create.go","lineNumber":35,"sourceCode":"// 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)\n}\n\n// PreparePublicCreateRequest snapshots, normalizes, and validates a public","sourceCodeStart":17,"sourceCodeEnd":53,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/internal/storage/issueops/public_create.go#L17-L53","documentation":"ValidatePublicCreateRequest rejects a create request whose embedded Issue carries Comments or Dependencies. These must be supplied through the dedicated request fields (request.Comments / request.Dependencies), not nested inside the issue payload, so the store can write them with correct provenance and ordering.","triggerScenarios":"Calling ExecuteCreate with a CreateRequest whose request.Issue.Comments or request.Issue.Dependencies slices are non-empty.","commonSituations":"Constructing a types.Issue struct copied from an existing issue (which often carries comments/deps) and reusing it in a create request; API migration from an older nested style.","solutions":["Clear request.Issue.Comments and request.Issue.Dependencies and pass them via the CreateRequest's dedicated Comments/Dependencies fields instead","Strip nested comments/dependencies when converting a loaded issue into a create request","Only pass these fields when you actually intend to create them alongside the issue"],"exampleFix":"// before\nissue.Comments = loadedComments\nreq := publicops.CreateRequest{Actor: actor, Issue: issue}\n// after\nissue.Comments = nil\nissue.Dependencies = nil\nreq := publicops.CreateRequest{Actor: actor, Issue: issue, Comments: loadedComments}","handlingStrategy":"validation","validationCode":"func issuePayloadClean(i *types.Issue) bool { return len(i.Comments) == 0 && len(i.Dependencies) == 0 }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never reuse a loaded issue struct (with comments/deps) directly as a create payload","Always move comments/dependencies to the top-level request fields","Add a normalize step that nils nested collections before building the request"],"tags":["create","validation","api-misuse"],"backgroundTag":"nested-payload-not-allowed","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}