{"record":{"id":"186143d7b8b75bbe","repo":"JetBrains/intellij-community","slug":"evaluation-error-cannot-evaluate-qualifier","errorCode":"evaluation.error.cannot.evaluate.qualifier","errorMessage":"Cannot evaluate qualifier ''{0}''","messagePattern":"Cannot evaluate qualifier ''(.+?)''","errorType":"exception","errorClass":"EvaluateRuntimeException","httpStatus":null,"severity":"error","filePath":"java/debugger/impl/src/com/intellij/debugger/engine/evaluation/expression/MethodEvaluator.java","lineNumber":113,"sourceCode":"      throw EvaluateExceptionUtil.createEvaluateException(JavaDebuggerBundle.message(\"evaluation.error.evaluating.method\", myMethodName));\n    }\n    List<Value> args = new ArrayList<>(myArgumentEvaluators.length);\n    for (Evaluator evaluator : myArgumentEvaluators) {\n      args.add((Value)evaluator.evaluate(context));\n    }\n    try {\n      ReferenceType referenceType = null;\n\n      if (object instanceof ObjectReference) {\n        // it seems that if we have an object of the class, the class must be ready, so no need to use findClass here\n        referenceType = ((ObjectReference)object).referenceType();\n      }\n      else if (isInvokableType(object)) {\n        referenceType = (ReferenceType)object;\n      }\n\n      if (referenceType == null) {\n        throw new EvaluateRuntimeException(EvaluateExceptionUtil.createEvaluateException(\n          JavaDebuggerBundle.message(\"evaluation.error.cannot.evaluate.qualifier\", myMethodName))\n        );\n      }\n      final String signature = myMethodSignature != null ? myMethodSignature.getName(debugProcess) : null;\n\n      if (requiresSuperObject && (referenceType instanceof ClassType)) {\n        referenceType = ((ClassType)referenceType).superclass();\n        String className = myClassName != null ? myClassName.getName(debugProcess) : null;\n        if (referenceType == null || (className != null && !className.equals(referenceType.name()))) {\n          referenceType = debugProcess.findClass(context, className, context.getClassLoader());\n        }\n      }\n\n      Method jdiMethod = null;\n      if (signature == null) {\n        // we know nothing about expected method's signature, so trying to match my method name and parameter count\n        // dummy matching, may be improved with types matching later\n        // IMPORTANT! using argumentTypeNames() instead of argumentTypes() to avoid type resolution inside JDI, which may be time-consuming","sourceCodeStart":95,"sourceCodeEnd":131,"githubUrl":"https://github.com/JetBrains/intellij-community/blob/be881553f2a76ac8b4ea53950d93f0de78295c19/java/debugger/impl/src/com/intellij/debugger/engine/evaluation/expression/MethodEvaluator.java#L95-L131","documentation":"Thrown by MethodEvaluator when it must invoke a method but the evaluated receiver is neither an ObjectReference (a live object in the debuggee) nor an invokable ReferenceType (a class/interface mirror for static invocation). Without a receiver mirror there is nothing to dispatch the call on, so evaluation aborts with the method name in the message.","triggerScenarios":"Evaluating 'receiver.method(...)' where the receiver evaluator produced null (field not yet initialized, previous expression returned null) or a non-reference JDI value (PrimitiveValue / VoidValue); referenceType stays null and EvaluateExceptionUtil.createEvaluateException(evaluation.error.cannot.evaluate.qualifier, myMethodName) is thrown. Note the message is built with the method name, not the qualifier expression.","commonSituations":"Calling a method on a null field at the current breakpoint ('this.dep.compute()' where dep is null); static call where the class mirror could not be loaded; chained calls 'a().b()' where a() returned null or void.","solutions":["Guard the call: evaluate 'receiver != null ? receiver.method() : null' or use Objects.requireNonNull","Inspect the receiver variable first (evaluate it alone) to confirm it is a live object","For static methods, use the fully qualified class name so the class mirror resolves"],"exampleFix":"// before: order.getCustomer().getName()\n\n// after: java.util.Objects.requireNonNull(order.getCustomer(), \"customer\").getName()","handlingStrategy":"validation","validationCode":"Object receiver = qualifierEvaluator.evaluate(context);\nif (receiver instanceof ObjectReference || isInvokableType(receiver)) {\n  methodEvaluator.evaluate(context);\n} else {\n  // receiver is null/primitive: report qualifier problem first\n}","typeGuard":"static boolean hasInvokableReceiver(Object o) {\n  return o instanceof ObjectReference || o instanceof ReferenceType;\n}","tryCatchPattern":"try {\n  evaluator.evaluate(context);\n} catch (EvaluateRuntimeException e) {\n  // evaluate the receiver alone to confirm it is a live object before retrying\n}","preventionTips":["Evaluate the receiver expression first and confirm it is a live object","Wrap receivers with Objects.requireNonNull in the fragment","Use fully qualified class names for static calls"],"tags":["debugger","evaluation","method-invocation","null-receiver"],"backgroundTag":null,"analyzedSha":"be881553f2a76ac8b4ea53950d93f0de78295c19","analyzedAt":"2026-08-14T14:13:06.425Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}