JetBrains/intellij-community · error · EvaluateRuntimeException
evaluation.error.cannot.evaluate.qualifier
evaluation.error.cannot.evaluate.qualifier
Error message
Cannot evaluate qualifier ''{0}'' What it means
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.
Source
Thrown at java/debugger/impl/src/com/intellij/debugger/engine/evaluation/expression/MethodEvaluator.java:113
throw EvaluateExceptionUtil.createEvaluateException(JavaDebuggerBundle.message("evaluation.error.evaluating.method", myMethodName));
}
List<Value> args = new ArrayList<>(myArgumentEvaluators.length);
for (Evaluator evaluator : myArgumentEvaluators) {
args.add((Value)evaluator.evaluate(context));
}
try {
ReferenceType referenceType = null;
if (object instanceof ObjectReference) {
// it seems that if we have an object of the class, the class must be ready, so no need to use findClass here
referenceType = ((ObjectReference)object).referenceType();
}
else if (isInvokableType(object)) {
referenceType = (ReferenceType)object;
}
if (referenceType == null) {
throw new EvaluateRuntimeException(EvaluateExceptionUtil.createEvaluateException(
JavaDebuggerBundle.message("evaluation.error.cannot.evaluate.qualifier", myMethodName))
);
}
final String signature = myMethodSignature != null ? myMethodSignature.getName(debugProcess) : null;
if (requiresSuperObject && (referenceType instanceof ClassType)) {
referenceType = ((ClassType)referenceType).superclass();
String className = myClassName != null ? myClassName.getName(debugProcess) : null;
if (referenceType == null || (className != null && !className.equals(referenceType.name()))) {
referenceType = debugProcess.findClass(context, className, context.getClassLoader());
}
}
Method jdiMethod = null;
if (signature == null) {
// we know nothing about expected method's signature, so trying to match my method name and parameter count
// dummy matching, may be improved with types matching later
// IMPORTANT! using argumentTypeNames() instead of argumentTypes() to avoid type resolution inside JDI, which may be time-consumingView on GitHub (pinned to be881553f2)
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
Example fix
// before: order.getCustomer().getName() // after: java.util.Objects.requireNonNull(order.getCustomer(), "customer").getName()
Defensive patterns
Strategy: validation
Validate before calling
Object receiver = qualifierEvaluator.evaluate(context);
if (receiver instanceof ObjectReference || isInvokableType(receiver)) {
methodEvaluator.evaluate(context);
} else {
// receiver is null/primitive: report qualifier problem first
} Type guard
static boolean hasInvokableReceiver(Object o) {
return o instanceof ObjectReference || o instanceof ReferenceType;
} Try / catch
try {
evaluator.evaluate(context);
} catch (EvaluateRuntimeException e) {
// evaluate the receiver alone to confirm it is a live object before retrying
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Interface method invocation is not supported in JVM {}. Use
- Cannot construct wrapper object for value of type {}: Unable
- Variable ''{0}'' is already declared
- Local variable declarations are not supported here.
- Invalid declaration : {0} Only local variable declarations a
AI-assisted analysis of JetBrains/intellij-community@be881553f2 (2026-08-14).
Data as JSON: /api/errors/186143d7b8b75bbe.
Report an issue: GitHub.