{"record":{"id":"db6ed863c1b22052","repo":"ory/hydra","slug":"plan-must-define-at-least-one-pagetokencolumn","errorCode":null,"errorMessage":"plan must define at least one PageTokenColumn","messagePattern":"plan must define at least one PageTokenColumn","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"oryx/pagination/paginationplanner/planner.go","lineNumber":22,"sourceCode":"package paginationplanner\n\nimport (\n\t\"github.com/pkg/errors\"\n\n\tkeysetpagination \"github.com/ory/x/pagination/keysetpagination_v2\"\n)\n\n// PaginationPlanner chooses the best [PaginationPlan] for a queriedColumns.\n// Plan is eligible when its required constraint set is satisfied (and an optional Condition matches).\n// If no plan matches, the FallbackPlan is used.\ntype PaginationPlanner struct {\n\tPlans        []PaginationPlan\n\tFallbackPlan PaginationPlan\n}\n\nfunc NewPaginationPlanner(fallbackPlan PaginationPlan, plans []PaginationPlan) (*PaginationPlanner, error) {\n\tif len(fallbackPlan.DefaultPageToken.Columns()) == 0 {\n\t\treturn nil, errors.New(\"plan must define at least one PageTokenColumn\")\n\t}\n\n\tfor i := range plans {\n\t\tplan := &plans[i]\n\t\tif len(plan.ApplicableQueries) == 0 {\n\t\t\treturn nil, errors.New(\"plan must define at least one ApplicableQueries\")\n\t\t}\n\t\tif len(plan.DefaultPageToken.Columns()) == 0 {\n\t\t\treturn nil, errors.New(\"plan must define a DefaultPageToken\")\n\t\t}\n\t\tplan.populateInternals()\n\t}\n\n\treturn &PaginationPlanner{\n\t\tPlans:        plans,\n\t\tFallbackPlan: fallbackPlan,\n\t}, nil\n}","sourceCodeStart":4,"sourceCodeEnd":40,"githubUrl":"https://github.com/ory/hydra/blob/4174065ffb052799890f7480f5360a877a67ffc1/oryx/pagination/paginationplanner/planner.go#L4-L40","documentation":"Returned by NewPaginationPlanner when the fallback plan's default page token defines no columns. A keyset pagination plan is meaningless without at least one PageTokenColumn to order by, so the planner cannot be constructed. This is a setup/configuration bug in the caller, not a runtime data problem.","triggerScenarios":"Thrown at oryx/pagination/paginationplanner/planner.go:22 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Give the fallback plan's DefaultPageToken at least one keysetpagination.PageTokenColumn","Verify the plan builder actually appends columns instead of returning an empty slice","Add a startup test that constructs the planner so misconfiguration fails fast in CI"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"4174065ffb052799890f7480f5360a877a67ffc1","analyzedAt":"2026-09-03T14:52:41.581Z","contentChangedAt":"2026-09-03T14:52:41.581Z","schemaVersion":2},"datasetVersion":"2026-09-10T17:17:09.494Z"}