{"record":{"id":"2f8b96b42adbdb6f","repo":"vitessio/vitess","slug":"unknown-aststep","errorCode":null,"errorMessage":"unknown ASTStep","messagePattern":"unknown ASTStep","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/tools/asthelpergen/integration/ast_path.go","lineNumber":85,"sourceCode":"\t\treturn \"(ValueSliceContainer).ASTImplementationElements\"\n\tcase SliceOfASTOffset:\n\t\treturn \"([]AST)[]Offset\"\n\tcase SliceOfRefOfLeafOffset:\n\t\treturn \"([]*Leaf)[]Offset\"\n\tcase RefOfValueContainerASTType:\n\t\treturn \"(*ValueContainer).ASTType\"\n\tcase RefOfValueContainerASTImplementationType:\n\t\treturn \"(*ValueContainer).ASTImplementationType\"\n\tcase RefOfValueSliceContainerASTElementsOffset:\n\t\treturn \"(*ValueSliceContainer).ASTElementsOffset\"\n\tcase RefOfValueSliceContainerASTImplementationElements:\n\t\treturn \"(*ValueSliceContainer).ASTImplementationElements\"\n\tcase RefOfOptionsl:\n\t\treturn \"(*Options).l\"\n\tcase VisitableInner:\n\t\treturn \"VisitableInner\"\n\t}\n\tpanic(\"unknown ASTStep\")\n}\n\nfunc GetNodeFromPath(node AST, path ASTPath) AST {\n\tfor len(path) >= 2 {\n\t\tstep := path.nextPathStep()\n\t\tpath = path[2:]\n\t\tswitch step {\n\t\tcase InterfaceSliceOffset:\n\t\t\tidx, bytesRead := path.nextPathOffset()\n\t\t\tpath = path[bytesRead:]\n\t\t\tnode = node.(InterfaceSlice)[idx]\n\t\tcase LeafSliceOffset:\n\t\t\tidx, bytesRead := path.nextPathOffset()\n\t\t\tpath = path[bytesRead:]\n\t\t\tnode = node.(LeafSlice)[idx]\n\t\tcase RefOfRefContainerASTType:\n\t\t\tnode = node.(*RefContainer).ASTType\n\t\tcase RefOfRefContainerASTImplementationType:","sourceCodeStart":67,"sourceCodeEnd":103,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/tools/asthelpergen/integration/ast_path.go#L67-L103","documentation":"In the generated AST-path machinery, DebugString maps each ASTStep enum value to a human-readable path element name. When a step value has no case in the switch, it panics 'unknown ASTStep', meaning a new step constant was added without updating this (manually maintained) integration file. Used for debugging AST paths collected during rewriting.","triggerScenarios":"Collecting an ASTPath (a.collectPaths / AddStep) whose step constant is not listed in DebugString's switch, then calling DebugString on it; typically after adding a new node/field step constant in go/tools/asthelpergen without updating ast_path.go.","commonSituations":"A developer adds a new AST node type or field, the enum grows, and a debug print of a collected path crashes during sqlparser work or tests that enable path collection.","solutions":["Add a case for the missing step constant in the DebugString switch in go/tools/asthelpergen/integration/ast_path.go","Regenerate/update the integration files so the step enum and DebugString stay in sync","As a workaround, use GetNodeFromPath directly instead of DebugString for the path in question"],"exampleFix":"// before\ncase VisitableInner:\n\treturn \"VisitableInner\"\n}\n// after\ncase VisitableInner:\n\treturn \"VisitableInner\"\ncase NewStepKind:\n\treturn \"(*SomeNode).NewField\"\n}","handlingStrategy":"validation","validationCode":"// Ensure every ASTStep constant has a DebugString case\nfor step := range allASTSteps {\n    if nameForStep(step) == \"\" {\n        log.Fatalf(\"ASTStep %d missing DebugString case\", step)\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Whenever you add an ASTStep constant, add its DebugString case in the same PR","Grep ast_path.go for the step constant list before regenerating","Keep a test that DebugString-prints a path containing every step kind"],"tags":["codegen","go","sqlparser","ast-path"],"backgroundTag":"unhandled-enum-case","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}