JetBrains/intellij-community · error · IllegalArgumentException
attribute '{attributeName}' is not a proper integer: {str}
Error message
attribute '{attributeName}' is not a proper integer: {str} What it means
Thrown by LwXmlReader.getRequiredInt when a required attribute's trimmed value cannot be parsed by Integer.parseInt. Grid layout metadata (row/column size, indentation, span counts, minimum size values) is stored as integer attributes; a non-numeric or malformed value fails with IllegalArgumentException naming the attribute and the bad string.
Source
Thrown at java/compiler/forms-compiler/src/com/intellij/uiDesigner/lw/LwXmlReader.java:66
return value;
}
else{
throw new IllegalArgumentException("attribute '" + attributeName + "' is required: "+element);
}
}
static String getOptionalString(final Element element, final String attributeName, final String defaultValue) {
final String value = element.getAttributeValue(attributeName);
return value != null ? value.trim() : defaultValue;
}
public static int getRequiredInt(final Element element, final String attributeName) {
final String str = getRequiredString(element, attributeName);
try {
return Integer.parseInt(str);
}
catch (NumberFormatException e) {
throw new IllegalArgumentException("attribute '" + attributeName + "' is not a proper integer: " + str);
}
}
static int getOptionalInt(final Element element, final String attributeName, final int defaultValue) {
final String str = element.getAttributeValue(attributeName);
if (str == null) {
return defaultValue;
}
try {
return Integer.parseInt(str);
}
catch (NumberFormatException e) {
throw new IllegalArgumentException("attribute '" + attributeName + "' is not a proper integer: " + str);
}
}
public static boolean getOptionalBoolean(final Element element, final String attributeName, final boolean defaultValue) {
final String str = element.getAttributeValue(attributeName);View on GitHub (pinned to be881553f2)
Solutions
- Set the attribute named in the message to a plain integer literal (e.g. height="20").
- If the value was meant to be computed/sized, use the designer's own sizing flags instead of custom text.
- Re-save the form from the GUI designer to restore canonical numeric values.
Example fix
<!-- before --> <row height="auto"/> <!-- after --> <row height="20" resizable="true"/>
Defensive patterns
Strategy: validation
Validate before calling
// Before parsing int attributes from generated XML
if (!str.trim().matches("-?\\d+")) throw new IllegalStateException("Attribute '" + attr + "' must be an integer, got: " + str); Try / catch
try { LwXmlReader.getRequiredInt(element, attr); } catch (IllegalArgumentException e) { if (e.getMessage().contains("not a proper integer")) { /* replace symbolic/unit value with a plain integer */ } else throw e; } Prevention
- Use plain integer literals in layout attributes; no units, no 'auto'.
- Run generated forms through the designer before committing.
When it happens
Trigger: A form-XML attribute read via getRequiredInt contains a non-integer, e.g. <row height="auto"/> or <grid row="1.5"/>, or whitespace-only after trimming, or a value with a unit suffix like "20px".
Common situations: Hand-editing form files and replacing numeric layout attributes with descriptive text; scripts templating forms with placeholder tokens left in numeric fields; locale-related edits inserting comma decimal separators into integer fields.
Related errors
- attribute '{attributeName}' is not a proper double: {str}
- attribute '{attributeName}' is not a proper float: {str}
- unexpected element: {element}
- String descriptor value required
- unexpected element: {element}
AI-assisted analysis of JetBrains/intellij-community@be881553f2 (2026-08-14).
Data as JSON: /api/errors/c8f62de68f682eb3.
Report an issue: GitHub.