{"record":{"id":"a27f43cc6497a341","repo":"cilium/cilium","slug":"s-preparecollection-invalid-ordering-constrai","errorCode":null,"errorMessage":"%s: PrepareCollection(): invalid ordering constraint: %v","messagePattern":"(.+?): PrepareCollection\\(\\): invalid ordering constraint: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/datapath/loader/plugins.go","lineNumber":369,"sourceCode":"\n\t\t\t\tcontinue\n\t\t\t}\n\n\t\t\thooksSpec.hook(ps.Name, h.Type).addNode(r.plugin.Name())\n\n\t\t\tfor _, c := range h.Constraints {\n\t\t\t\totherPlugin := lnc.Plugins[c.Plugin]\n\t\t\t\tif otherPlugin == nil {\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\n\t\t\t\tswitch c.Order {\n\t\t\t\tcase datapathplugins.PrepareCollectionResponse_HookSpec_OrderingConstraint_BEFORE:\n\t\t\t\t\thooksSpec.hook(ps.Name, h.Type).before(r.plugin.Name(), otherPlugin.Name())\n\t\t\t\tcase datapathplugins.PrepareCollectionResponse_HookSpec_OrderingConstraint_AFTER:\n\t\t\t\t\thooksSpec.hook(ps.Name, h.Type).after(r.plugin.Name(), otherPlugin.Name())\n\t\t\t\tdefault:\n\t\t\t\t\terr = errors.Join(err, fmt.Errorf(\"%s: PrepareCollection(): invalid ordering constraint: %v\", r.plugin.Name(), c.Order))\n\t\t\t\t\tcontinue process_hooks\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tinstrumentCollectionRequests, programPatches, err := hooksSpec.instrumentCollection(spec)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"instrumenting collection: %w\", err)\n\t}\n\topts.ProgramPatches = programPatches\n\n\tfor plugin, req := range instrumentCollectionRequests {\n\t\tprepareHooksResp := responses[plugin]","sourceCodeStart":351,"sourceCodeEnd":387,"githubUrl":"https://github.com/cilium/cilium/blob/ac7b90affa4baf0642e6685319d56907b3a73a6d/pkg/datapath/loader/plugins.go#L351-L387","documentation":"Plugins may express ordering constraints (BEFORE/AFTER) between their hooks and other plugins' hooks on the same program. An OrderingConstraint value outside the known enum is rejected with '<plugin>: PrepareCollection(): invalid ordering constraint: %v', aborting hook preparation.","triggerScenarios":"A plugin response includes a hook ordering constraint c.Order that is neither BEFORE nor AFTER — typically an enum value from a newer plugin protocol unknown to this agent, or an unset/invalid field from a buggy plugin.","commonSituations":"Mixed-version agent/plugin deployments where the plugin emits a new OrderingConstraint value; plugin implementation bug writing an out-of-range enum; corrupted/garbled plugin response over the transport.","solutions":["Upgrade the agent (or downgrade the plugin) so the OrderingConstraint enum values match","Fix the plugin to emit only BEFORE/AFTER ordering constraints","Regenerate plugin protobuf bindings from the shared datapathplugins proto","Remove ordering constraints from the plugin's response if they are not strictly needed","Disable the offending plugin until fixed"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"func validOrderingConstraint(c OrderingConstraint) bool {\n    return c == OrderingConstraint_BEFORE || c == OrderingConstraint_AFTER\n}","typeGuard":"func isKnownOrdering(c PrepareCollectionResponse_HookSpec_OrderingConstraint) bool {\n    return c == OrderingConstraint_BEFORE || c == OrderingConstraint_AFTER\n}","tryCatchPattern":null,"preventionTips":["Share one generated proto package between agent and plugins","Fail fast in plugin code if an OrderingConstraint value is unknown locally","Gate new enum values behind version negotiation","Avoid emitting constraints unless the plugin needs strict ordering"],"tags":["ebpf","plugin","proto","ordering"],"backgroundTag":"invalid-ordering-constraint","analyzedSha":"ac7b90affa4baf0642e6685319d56907b3a73a6d","analyzedAt":"2026-08-31T18:27:15.868Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}