{"record":{"id":"bf09798fcb115373","repo":"gastownhall/beads","slug":"errvalidation-bf0979","errorCode":"ErrValidation","errorMessage":"%w: apply batch item %d has unknown kind %q","messagePattern":"%w: apply batch item (.+?) has unknown kind %q","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/storage/uow/batch_applier.go","lineNumber":142,"sourceCode":"\tif err := r.spliceMetadataRefs(ctx); err != nil {\n\t\treturn err\n\t}\n\treturn r.runEndGate(ctx)\n}\n\nfunc (r *uowApplyRun) applyItem(ctx context.Context, index int) error {\n\titem := r.plan.Items[index]\n\tswitch item.Kind {\n\tcase publicops.ItemCreate:\n\t\treturn r.applyCreate(ctx, index, item.Create)\n\tcase publicops.ItemUpdate:\n\t\treturn r.applyUpdate(ctx, index, item.Update)\n\tcase publicops.ItemClose:\n\t\treturn r.applyClose(ctx, index, item.Close)\n\tcase publicops.ItemDepAdd:\n\t\treturn r.applyDepAdd(ctx, index, item.DepAdd)\n\t}\n\treturn fmt.Errorf(\"%w: apply batch item %d has unknown kind %q\", publicops.ErrValidation, index, item.Kind)\n}\n\n// applyCreate mints one row through the same preparation, infra-type routing\n// and error classification the single create and the create batch run, so an\n// item's content rules ARE Lifecycle.Create's.\nfunc (r *uowApplyRun) applyCreate(ctx context.Context, index int, item *publicops.CreateItem) error {\n\titemErr := func(err error) error {\n\t\treturn &publicops.ItemError{Index: index, Kind: publicops.ItemCreate, Key: item.Key, Err: err}\n\t}\n\tcreateContext, err := r.loadCreateContext(ctx)\n\tif err != nil {\n\t\treturn err\n\t}\n\tprepared, err := storageissueops.PreparePublicCreateRequest(publicops.CreateRequest{\n\t\tActor:         r.plan.Actor,\n\t\tIssue:         item.Issue,\n\t\tForceIDPrefix: r.plan.ForceIDPrefix,\n\t}, storageissueops.PublicCreateContext{","sourceCodeStart":124,"sourceCodeEnd":160,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/internal/storage/uow/batch_applier.go#L124-L160","documentation":"A validation error from the unit-of-work batch applier: a batch item carried a Kind the applier does not recognize. Only create, update, close, and dep-add items are supported; anything else fails the whole apply with publicops.ErrValidation.","triggerScenarios":"Submitting a batch (apply path) whose Items array contains an item whose Kind is not one of ItemCreate, ItemUpdate, ItemClose, ItemDepAdd — typically from a client built against a newer/older API version or hand-assembled payloads.","commonSituations":"Version skew between a CLI/SDK client and the server (client sends a newly added item kind the server does not know); corrupt or hand-edited batch payloads; forwarding a batch from a newer primary to an older replica.","solutions":["Upgrade the server/binary so it recognizes the item kind the client is sending","Check client and server versions match (bd version on both ends)","Inspect the batch payload at the reported index and remove/correct the unknown kind","If hand-building batches, only use the documented publicops item constructors"],"exampleFix":"// before\nitems := []publicops.BatchItem{{Kind: \"item_reorder\", ...}} // unknown kind\n// after\nitems := []publicops.BatchItem{{Kind: publicops.ItemUpdate, Update: ...}}","handlingStrategy":"validation","validationCode":"supported := map[publicops.ItemKind]bool{\n    publicops.ItemCreate: true, publicops.ItemUpdate: true,\n    publicops.ItemClose: true, publicops.ItemDepAdd: true,\n}\nfor i, it := range batch.Items {\n    if !supported[it.Kind] { return fmt.Errorf(\"item %d: unsupported kind %q\", i, it.Kind) }\n}","typeGuard":null,"tryCatchPattern":"err := applyBatch(ctx, batch)\nif errors.Is(err, publicops.ErrValidation) {\n    var itemErr *publicops.ItemError\n    if errors.As(err, &itemErr) { /* inspect itemErr.Index / Kind */ }\n}","preventionTips":["Keep client and server on matching versions","Only construct batch items via publicops constructors","Validate batch payloads before submission","Pin the SDK version your scripts were written against"],"tags":["validation","batch","api-versioning"],"backgroundTag":"unsupported-item-kind","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}