{"record":{"id":"f0b5bb05dbd42d01","repo":"go-delve/delve","slug":"operator-s-not-supported","errorCode":null,"errorMessage":"operator %s not supported","messagePattern":"operator (.+?) not supported","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/proc/evalop/evalcompile.go","lineNumber":404,"sourceCode":"\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 {\n\t\tcase token.INC, token.DEC, token.ARROW:\n\t\t\treturn fmt.Errorf(\"operator %s not supported\", node.Op.String())\n\t\t}\n\t\t// short circuits logical operators\n\t\tvar sop *Jump\n\t\tswitch node.Op {\n\t\tcase token.LAND:\n\t\t\tsop = &Jump{When: JumpIfFalse, Node: node.X}\n\t\tcase token.LOR:\n\t\t\tsop = &Jump{When: JumpIfTrue, Node: node.X}\n\t\t}\n\t\terr := ctx.compileBinary(node.X, node.Y, sop, &Binary{node})\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif sop != nil {\n\t\t\tsop.Target = len(ctx.ops)\n\t\t\tctx.pushOp(&BoolToConst{})\n\t\t}\n","sourceCodeStart":386,"sourceCodeEnd":422,"githubUrl":"https://github.com/go-delve/delve/blob/a23773e6c31361e43246bc43a424ee009679b174/pkg/proc/evalop/evalcompile.go#L386-L422","documentation":"Delve's expression compiler rejects the increment, decrement, and channel-receive operators because they mutate state or interact with channels, which the debugger's expression evaluator (a read-only side-effect-free evaluator) cannot support. When compiling an *ast.BinaryExpr whose Op is token.INC, token.DEC, or token.ARROW, compileAST returns this error instead of generating ops. It is a hard limitation of the evaluator, not a bug.","triggerScenarios":"Evaluating any expression via dlv eval/print/set that contains 'x++', 'x--', or '<-ch' (the AST represents these in a BinaryExpr position during compilation). Also reached when a Set expression or a call-injection argument contains these operators.","commonSituations":"Typing 'print i++' at the (dlv) prompt out of habit from C/Java; trying to receive from a channel with 'print <-ch' to inspect a value; IDE watch expressions that auto-increment; converting debugging sessions from gdb (which supports some of these) to delve.","solutions":["Remove the increment/decrement/receive operator and use the equivalent expression instead, e.g. 'print i' then 'set i = i + 1'","For channel receive, step into or over the receive in code, or read the channel's internals via its fields instead of '<-ch'","If the expression comes from an IDE watch/config, edit the watch to a pure read expression"],"exampleFix":"// before (dlv REPL)\n(dlv) set i = i++\n// after\n(dlv) set i = i + 1","handlingStrategy":"validation","validationCode":"// Before submitting the expression, reject mutating/channel operators\nfunc hasUnsupportedOp(src string) bool {\n\tfor _, bad := range []string{\"++\", \"--\", \"<-\"} {\n\t\tif strings.Contains(src, bad) { return true }\n\t}\n\treturn false\n}\nif hasUnsupportedOp(expr) { /* rewrite expr before eval */ }","typeGuard":"null","tryCatchPattern":"null","preventionTips":["Use only side-effect-free read expressions in print/watch","Replace i++ with set i = i + 1","Never use <-ch in debugger expressions; observe channel state via fields"],"tags":["debugger","expression-evaluation","delve"],"backgroundTag":"unsupported-operator","analyzedSha":"a23773e6c31361e43246bc43a424ee009679b174","analyzedAt":"2026-08-31T15:12:45.221Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}