go-delve/delve · error
cannot set the variable without evaluate name
Error message
cannot set the variable without evaluate name
What it means
During setVariable, the server resolves the variable by name among the children of the parent variable handle. If a matching child is found but has an empty EvaluateName, delve cannot construct an expression to pass to the evaluator, so it returns this error. Some variables (registers, synthetic entries, some struct fields) lack an evaluable name.
Source
Thrown at service/dap/server.go:3595
// onReverseContinueRequest performs a rewind command call up to the previous
// breakpoint or the start of the process
// This is an optional request enabled by capability 'supportsStepBackRequest'.
func (s *Session) onReverseContinueRequest(request *dap.ReverseContinueRequest, allowNextStateChange *syncflag) {
s.send(&dap.ReverseContinueResponse{
Response: *s.newResponse(request.Request),
})
s.runUntilStopAndNotify(api.Rewind, allowNextStateChange)
}
// computeEvaluateName finds the named child, and computes its evaluate name.
func (s *Session) computeEvaluateName(v *fullyQualifiedVariable, cname string) (string, error) {
children := s.childrenToDAPVariables(v)
for _, c := range children {
if c.Name == cname {
if c.EvaluateName != "" {
return c.EvaluateName, nil
}
return "", errors.New("cannot set the variable without evaluate name")
}
}
return "", errors.New("failed to find the named variable")
}
// onSetVariableRequest handles 'setVariable' requests.
func (s *Session) onSetVariableRequest(request *dap.SetVariableRequest) {
arg := request.Arguments
v, ok := s.variableHandles.get(arg.VariablesReference)
if !ok {
s.sendErrorResponse(request.Request, UnableToSetVariable, "Unable to lookup variable", fmt.Sprintf("unknown reference %d", arg.VariablesReference))
return
}
// We need to translate the arg.Name to its evaluateName if the name
// refers to a field or element of a variable.
// https://github.com/microsoft/vscode/issues/120774
evaluateName, err := s.computeEvaluateName(v, arg.Name)View on GitHub (pinned to a23773e6c3)
Solutions
- Set the variable via an 'evaluate' (repl/setExpression) request using a valid expression instead (e.g. 'x.field = 5')
- Edit the value at a level of the hierarchy that does have an evaluateName
- Verify the code is compiled without aggressive optimization (-gcflags=all='-N -l') so variables remain addressable
- Check whether delve supports setting that variable kind; some (registers, certain map keys) are not settable
Example fix
// before: setVariable on child with empty evaluateName
{variablesReference: parentId, name: 'inner.field', value: '5'}
// after: use setExpression / evaluate
{expression: 'outer.inner.field = 5', frameId: topFrameId} Defensive patterns
Strategy: fallback
Validate before calling
// pick a child with an evaluateName before offering edit
if child.EvaluateName == "" { disableEditing(child) } Type guard
func settable(c Variable) bool { return c.EvaluateName != "" } Try / catch
if err.Error() == "cannot set the variable without evaluate name" {
// fallback: use setExpression/evaluate with a manually built expression
} Prevention
- Only enable inline editing for variables whose evaluateName is present
- Compile with -gcflags=all='-N -l' to keep variables evaluable
- Offer setExpression as the edit path for synthetic/complex children
When it happens
Trigger: Calling setVariable on a child whose EvaluateName is empty — e.g. setting values in the Variables view for variables that have no corresponding eval expression (certain composite children, variables from optimized scopes, synthetic children).
Common situations: IDE users editing values of nested struct fields or slice elements that delve cannot map back to an expression; variables produced by pretty-printed/synthetic representations; optimized-out variables shown in the variables pane.
Related errors
- failed to find the named variable
- wrong real type for map
- another launch request is in progress
- breakpoint already exists
- unable to set breakpoint
AI-assisted analysis of go-delve/delve@a23773e6c3 (2026-08-31).
Data as JSON: /api/errors/1cff34f62324d0b4.
Report an issue: GitHub.