{"record":{"id":"ce500b775df9a685","repo":"go-delve/delve","slug":"3-index-slice-expressions-not-supported","errorCode":null,"errorMessage":"3-index slice expressions not supported","messagePattern":"3-index slice expressions not supported","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/proc/evalop/evalcompile.go","lineNumber":384,"sourceCode":"\t\t\ts, err := strconv.Unquote(x.Value)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tctx.pushOp(&PushPackageVarOrSelect{Name: s, Sel: node.Sel.Name, NameIsString: true})\n\n\t\tdefault:\n\t\t\treturn ctx.compileUnary(node.X, &Select{node.Sel.Name})\n\t\t}\n\n\tcase *ast.TypeAssertExpr: // <expression>.(<type>)\n\t\treturn ctx.compileTypeAssert(node)\n\n\tcase *ast.IndexExpr:\n\t\treturn ctx.compileBinary(node.X, node.Index, nil, &Index{node})\n\n\tcase *ast.SliceExpr:\n\t\tif node.Slice3 {\n\t\t\treturn errors.New(\"3-index slice expressions not supported\")\n\t\t}\n\t\treturn ctx.compileReslice(node)\n\n\tcase *ast.StarExpr:\n\t\t// pointer dereferencing *<expression>\n\t\treturn ctx.compileUnary(node.X, &PointerDeref{node})\n\n\tcase *ast.UnaryExpr:\n\t\t// The unary operators we support are +, - and & (note that unary * is parsed as ast.StarExpr)\n\t\tswitch node.Op {\n\t\tcase token.AND:\n\t\t\treturn ctx.compileUnary(node.X, &AddrOf{node})\n\t\tdefault:\n\t\t\treturn ctx.compileUnary(node.X, &Unary{node})\n\t\t}\n\n\tcase *ast.BinaryExpr:\n\t\tswitch node.Op {","sourceCodeStart":366,"sourceCodeEnd":402,"githubUrl":"https://github.com/go-delve/delve/blob/a23773e6c31361e43246bc43a424ee009679b174/pkg/proc/evalop/evalcompile.go#L366-L402","documentation":"Raised at compile time by compileAST in pkg/proc/evalop/evalcompile.go when an expression uses a 3-index slice expression a[low:high:max]. Delve's expression evaluator supports only 2-index reslices; the max-capacity component has no representation in its evaluation model.","triggerScenarios":"Evaluating any expression of the form s[i:j:k] (Slice3 == true) via the terminal eval/print command, conditional breakpoints, or the EvaluateVariable API.","commonSituations":"Pasting production slicing code into the debugger prompt; verifying capacity tricks with 3-index slices; IDE watch expressions generated from source containing a[i:j:k].","solutions":["Drop the third index: evaluate s[i:j] and separately print cap(s) if capacity is what you need","Split into multiple evaluations: print s[i:j] then print &s[i:j] / len/cap checks","Compute the equivalent bounds in the debugged program and inspect those variables"],"exampleFix":"// before\ndlv> print s[1:5:10]\n// after\ndlv> print s[1:5]\ndlv> print cap(s)","handlingStrategy":"validation","validationCode":"import \"go/ast\"\nfunc isSlice3(e ast.Expr) bool {\n\tif se, ok := e.(*ast.SliceExpr); ok { return se.Slice3 }\n\treturn false\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never paste a[i:j:k] expressions into the debugger; split into a[i:j] plus cap() checks","Strip third slice indices when generating watch expressions from source","Use len/cap queries separately"],"tags":["go","eval","slice","compile"],"backgroundTag":"unsupported-expression-syntax","analyzedSha":"a23773e6c31361e43246bc43a424ee009679b174","analyzedAt":"2026-08-31T15:12:45.221Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}