JetBrains/intellij-community · error · EvaluateException

Invalid field name ''{0}''

Error message

Invalid field name ''{0}''

What it means

Error "Invalid field name ''{0}''" thrown in JetBrains/intellij-community.

Source

Thrown at java/debugger/impl/src/com/intellij/debugger/ui/impl/watch/FieldDescriptorImpl.java:201

  }

  @Override
  public PsiExpression getDescriptorEvaluation(DebuggerContext context) throws EvaluateException {
    PsiElementFactory elementFactory = JavaPsiFacade.getElementFactory(myProject);
    String fieldName;
    if (isStatic()) {
      String typeName = myField.declaringType().name().replace('$', '.');
      typeName = DebuggerTreeNodeExpression.normalize(typeName, PositionUtil.getContextElement(context), myProject);
      fieldName = typeName + "." + getName();
    }
    else {
      fieldName = isOuterLocalVariableValue() ? StringUtil.trimStart(getName(), OUTER_LOCAL_VAR_FIELD_PREFIX) : "this." + getName();
    }
    try {
      return elementFactory.createExpressionFromText(fieldName, null);
    }
    catch (IncorrectOperationException e) {
      throw new EvaluateException(JavaDebuggerBundle.message("error.invalid.field.name", getName()), e);
    }
  }

  @Override
  public XValueModifier getModifier(JavaValue value) {
    return new JavaValueModifier(value) {
      @Override
      protected void setValueImpl(@NotNull XExpression expression, @NotNull XModificationCallback callback) {
        final DebuggerContextImpl debuggerContext = DebuggerManagerEx.getInstanceEx(getProject()).getContext();
        Field field = getField();
        FieldValueSetter setter = null;

        if (!field.isStatic()) {
          ObjectReference object = getObject();
          if (object != null) {
            setter = v -> object.setValue(field, v);
          }
        }

View on GitHub (pinned to be881553f2)

Solutions

  1. Use a valid Java identifier as the field name.
  2. Check for typos and avoid special characters in the field reference.

Example fix

Use 'count' instead of '1count' in the expression.

When it happens

Trigger: A field reference in a debugger expression is not a legal Java identifier.

Common situations: Typing an invalid field name into a watch or renderer expression.


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