{"record":{"id":"1cff34f62324d0b4","repo":"go-delve/delve","slug":"cannot-set-the-variable-without-evaluate-name","errorCode":null,"errorMessage":"cannot set the variable without evaluate name","messagePattern":"cannot set the variable without evaluate name","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"service/dap/server.go","lineNumber":3595,"sourceCode":"// onReverseContinueRequest performs a rewind command call up to the previous\n// breakpoint or the start of the process\n// This is an optional request enabled by capability 'supportsStepBackRequest'.\nfunc (s *Session) onReverseContinueRequest(request *dap.ReverseContinueRequest, allowNextStateChange *syncflag) {\n\ts.send(&dap.ReverseContinueResponse{\n\t\tResponse: *s.newResponse(request.Request),\n\t})\n\ts.runUntilStopAndNotify(api.Rewind, allowNextStateChange)\n}\n\n// computeEvaluateName finds the named child, and computes its evaluate name.\nfunc (s *Session) computeEvaluateName(v *fullyQualifiedVariable, cname string) (string, error) {\n\tchildren := s.childrenToDAPVariables(v)\n\tfor _, c := range children {\n\t\tif c.Name == cname {\n\t\t\tif c.EvaluateName != \"\" {\n\t\t\t\treturn c.EvaluateName, nil\n\t\t\t}\n\t\t\treturn \"\", errors.New(\"cannot set the variable without evaluate name\")\n\t\t}\n\t}\n\treturn \"\", errors.New(\"failed to find the named variable\")\n}\n\n// onSetVariableRequest handles 'setVariable' requests.\nfunc (s *Session) onSetVariableRequest(request *dap.SetVariableRequest) {\n\targ := request.Arguments\n\n\tv, ok := s.variableHandles.get(arg.VariablesReference)\n\tif !ok {\n\t\ts.sendErrorResponse(request.Request, UnableToSetVariable, \"Unable to lookup variable\", fmt.Sprintf(\"unknown reference %d\", arg.VariablesReference))\n\t\treturn\n\t}\n\t// We need to translate the arg.Name to its evaluateName if the name\n\t// refers to a field or element of a variable.\n\t// https://github.com/microsoft/vscode/issues/120774\n\tevaluateName, err := s.computeEvaluateName(v, arg.Name)","sourceCodeStart":3577,"sourceCodeEnd":3613,"githubUrl":"https://github.com/go-delve/delve/blob/a23773e6c31361e43246bc43a424ee009679b174/service/dap/server.go#L3577-L3613","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","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"],"exampleFix":"// before: setVariable on child with empty evaluateName\n{variablesReference: parentId, name: 'inner.field', value: '5'}\n// after: use setExpression / evaluate\n{expression: 'outer.inner.field = 5', frameId: topFrameId}","handlingStrategy":"fallback","validationCode":"// pick a child with an evaluateName before offering edit\nif child.EvaluateName == \"\" { disableEditing(child) }","typeGuard":"func settable(c Variable) bool { return c.EvaluateName != \"\" }","tryCatchPattern":"if err.Error() == \"cannot set the variable without evaluate name\" {\n    // fallback: use setExpression/evaluate with a manually built expression\n}","preventionTips":["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"],"tags":["dap","set-variable","variables","go"],"backgroundTag":"variable-without-evaluate-name","analyzedSha":"a23773e6c31361e43246bc43a424ee009679b174","analyzedAt":"2026-08-31T15:12:45.221Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}