JetBrains/intellij-community · warning · EvaluateException

Invalid field name '{0}'

Error message

Invalid field name '{0}'

What it means

ClassRenderer.getChildValueExpression builds the expression 'this.<fieldName>' for a child node of an object in the Variables view and parses it with PsiElementFactory.createExpressionFromText scoped to the object's class. If parsing fails with IncorrectOperationException (field name is not a valid Java identifier or the containing class cannot be resolved), it becomes this EvaluateException.

Source

Thrown at java/debugger/impl/src/com/intellij/debugger/ui/tree/render/ClassRenderer.java:345

  @Override
  public void writeExternal(Element element) throws WriteExternalException {
    super.writeExternal(element);
    DefaultJDOMExternalizer.write(this, element, new DifferenceFilter<>(this, new ClassRenderer()));
  }

  @Override
  public PsiElement getChildValueExpression(DebuggerTreeNode node, DebuggerContext context) throws EvaluateException {
    DescriptorWithParentObject descriptor = (DescriptorWithParentObject)node.getDescriptor();

    PsiElementFactory elementFactory = JavaPsiFacade.getElementFactory(node.getProject());
    try {
      return elementFactory.createExpressionFromText("this." + descriptor.getName(), DebuggerUtils.findClass(
        descriptor.getObject().referenceType().name(), context.getProject(), context.getDebugProcess().getSearchScope())
      );
    }
    catch (IncorrectOperationException e) {
      throw new EvaluateException(JavaDebuggerBundle.message("error.invalid.field.name", descriptor.getName()), null);
    }
  }

  @Override
  public CompletableFuture<Boolean> isExpandableAsync(Value value, EvaluationContext evaluationContext, NodeDescriptor parentDescriptor) {
    DebuggerManagerThreadImpl.assertIsManagerThread();
    if (value instanceof ArrayReference) {
      return DebuggerUtilsAsync.length((ArrayReference)value).thenApply(r -> r > 0).exceptionally(throwable -> true);
    }
    else if (value instanceof ObjectReference) {
      return CompletableFuture.completedFuture(true); // if object has no fields, it contains a child-message about that
      //return ((ObjectReference)value).referenceType().allFields().size() > 0;
    }

    return CompletableFuture.completedFuture(false);
  }

  @Override

View on GitHub (pinned to be881553f2)

Solutions

  1. Ensure the classpath configured in the run configuration matches the jars actually loaded by the debugged process so findClass succeeds
  2. Rebuild/re-deobfuscate the target so field names are legal identifiers, or disable obfuscation for debug builds
  3. Attach sources or decompiled sources for the library containing the class so the IDE can resolve it
  4. As a workaround, evaluate the field through a manually typed Watch expression instead of expanding the tree node
Defensive patterns

Strategy: try-catch

Validate before calling

// ensure the object's class is resolvable in the IDE before expanding children
PsiClass cls = DebuggerUtils.findClass(refType.name(), project, scope);
if (cls == null) return; // 'this.<field>' will not parse without the class scope

Try / catch

try {
  renderer.getChildValueExpression(node, context);
} catch (EvaluateException e) {
  // field name not parseable / class unresolvable: display raw JDI value instead
}

Prevention

When it happens

Trigger: Expanding an object in the debugger tree where a field name comes back empty or illegal as an identifier (obfuscated bytecode, synthetic fields), or where DebuggerUtils.findClass cannot locate the object's class in the IDE index, so 'this.<name>' cannot be parsed against that class.

Common situations: Debugging obfuscated/minified code (R8/ProGuard produce field names like 'a' that are valid, but sometimes empty or keyword-clashing names in non-Java bytecode); class not on the IDE's indexed classpath (remote process with different jars); debugging Kotlin/Scala synthetic fields.

Related errors


AI-assisted analysis of JetBrains/intellij-community@be881553f2 (2026-08-14). Data as JSON: /api/errors/7e5ced31446d124d. Report an issue: GitHub.