{"record":{"id":"9cbf9af48dd8bbeb","repo":"cayleygraph/cayley","slug":"not-implemented","errorCode":null,"errorMessage":"not implemented","messagePattern":"not implemented","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"query/path/morphism_apply_functions.go","lineNumber":211,"sourceCode":"\t\t\tout := ctx.copy()\n\t\t\tctx.labelSet = path\n\t\t\treturn labelContextMorphism(tags, via...), &out\n\t\t},\n\t\tApply: func(in shape.Shape, ctx *pathContext) (shape.Shape, *pathContext) {\n\t\t\tout := ctx.copy()\n\t\t\tout.labelSet = path\n\t\t\treturn in, &out\n\t\t},\n\t\ttags: tags,\n\t}\n}\n\n// labelsMorphism iterates to the uniqified set of labels from\n// the given set of nodes in the path.\nfunc labelsMorphism() morphism {\n\treturn morphism{\n\t\tReversal: func(ctx *pathContext) (morphism, *pathContext) {\n\t\t\tpanic(\"not implemented\")\n\t\t},\n\t\tApply: func(in shape.Shape, ctx *pathContext) (shape.Shape, *pathContext) {\n\t\t\treturn shape.Labels(in), ctx\n\t\t},\n\t}\n}\n\n// predicatesMorphism iterates to the uniqified set of predicates from\n// the given set of nodes in the path.\nfunc predicatesMorphism(isIn bool) morphism {\n\treturn morphism{\n\t\tReversal: func(ctx *pathContext) (morphism, *pathContext) {\n\t\t\tpanic(\"not implemented: need a function from predicates to their associated edges\")\n\t\t},\n\t\tApply: func(in shape.Shape, ctx *pathContext) (shape.Shape, *pathContext) {\n\t\t\treturn shape.Predicates(in, isIn), ctx\n\t\t},\n\t}","sourceCodeStart":193,"sourceCodeEnd":229,"githubUrl":"https://github.com/cayleygraph/cayley/blob/81dcd7d73e45136bc0d01802a8ba4685d8a533eb/query/path/morphism_apply_functions.go#L193-L229","documentation":"labelsMorphism() defines a path morphism whose Reversal is unimplemented; evaluating the reverse traversal panics with 'not implemented'. Forward application simply maps the shape via shape.Labels, but Cayley cannot reverse the labels step.","triggerScenarios":"A reversed/backtracking traversal that includes the labels() step, forcing evaluation of the morphism's Reversal function (e.g. via Back() or reverse path evaluation).","commonSituations":"Gremlin-style queries using labels() inside a context that requires reversal; ported legacy code where the labels step lands on the reverse side of a path.","solutions":["Restructure the query so labels() is only applied forward and never reversed.","Replace labels() with an equivalent explicit traversal that supports reversal.","If maintaining a fork, implement the Reversal function to undo shape.Labels."],"exampleFix":"// before: labels() used inside a reversed path\nm := cayley.StartMorphism().Labels() // reversed later -> panic\n// after: keep the labels step forward-only\nresults := cayley.NewPath(qs).Out(pred).Labels()...","handlingStrategy":"type-guard","validationCode":"if pathWillBeReversed && pathContainsLabelsStep {\n    return errors.New(\"labels() step cannot be reversed; restructure the query\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Only use labels() in forward application.","Avoid Back()/reverse evaluation over labels steps.","recover() around path construction in plugins."],"tags":["panic","path","morphism","cayley","gremlin"],"backgroundTag":"method-not-implemented","analyzedSha":"81dcd7d73e45136bc0d01802a8ba4685d8a533eb","analyzedAt":"2026-09-06T06:14:12.358Z","contentChangedAt":"2026-09-06T06:14:12.358Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}