go-delve/delve · error
3-index slice expressions not supported
Error message
3-index slice expressions not supported
What it means
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.
Source
Thrown at pkg/proc/evalop/evalcompile.go:384
s, err := strconv.Unquote(x.Value)
if err != nil {
return err
}
ctx.pushOp(&PushPackageVarOrSelect{Name: s, Sel: node.Sel.Name, NameIsString: true})
default:
return ctx.compileUnary(node.X, &Select{node.Sel.Name})
}
case *ast.TypeAssertExpr: // <expression>.(<type>)
return ctx.compileTypeAssert(node)
case *ast.IndexExpr:
return ctx.compileBinary(node.X, node.Index, nil, &Index{node})
case *ast.SliceExpr:
if node.Slice3 {
return errors.New("3-index slice expressions not supported")
}
return ctx.compileReslice(node)
case *ast.StarExpr:
// pointer dereferencing *<expression>
return ctx.compileUnary(node.X, &PointerDeref{node})
case *ast.UnaryExpr:
// The unary operators we support are +, - and & (note that unary * is parsed as ast.StarExpr)
switch node.Op {
case token.AND:
return ctx.compileUnary(node.X, &AddrOf{node})
default:
return ctx.compileUnary(node.X, &Unary{node})
}
case *ast.BinaryExpr:
switch node.Op {View on GitHub (pinned to a23773e6c3)
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
Example fix
// before dlv> print s[1:5:10] // after dlv> print s[1:5] dlv> print cap(s)
Defensive patterns
Strategy: validation
Validate before calling
import "go/ast"
func isSlice3(e ast.Expr) bool {
if se, ok := e.(*ast.SliceExpr); ok { return se.Slice3 }
return false
} Prevention
- 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
When it happens
Trigger: Evaluating any expression of the form s[i:j:k] (Slice3 == true) via the terminal eval/print command, conditional breakpoints, or the EvaluateVariable API.
Common situations: 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].
Related errors
- evaluating methods not supported on this version of Go
- function calls not allowed without using 'call'
- literal can not be allocated because function calls are not
- can not convert value of type %s to int
- can not convert value of type %s to uint
AI-assisted analysis of go-delve/delve@a23773e6c3 (2026-08-31).
Data as JSON: /api/errors/ce500b775df9a685.
Report an issue: GitHub.