iflytek/astron-agent · error · IllegalArgumentException
Unable to parse boolean value: '
Error message
Unable to parse boolean value: '
What it means
parseBoolean in DBExcelReadListener throws this IllegalArgumentException when a Boolean-typed field's cell value is not exactly "true" or "false" (after trim and lowercase). Unlike other parsers that use broader conversions, boolean parsing here only accepts the two literal strings. The message includes the offending raw value (note: the closing quote is missing from the message format).
Solutions
- Change the cell value to exactly true or false (case-insensitive, no extra characters).
- If 1/0 or yes/no should be supported, extend parseBoolean to accept those aliases.
- Verify the column really is Boolean-typed in the table definition; if it should be String, change the field type so no boolean parsing occurs.
Example fix
// before // cell value: 1 -> Unable to parse boolean value: '1 // after // cell value: true
Defensive patterns
Strategy: validation
Validate before calling
// validate Boolean cells before import
String v = cell == null ? "" : cell.trim().toLowerCase(Locale.ROOT);
if (!v.equals("true") && !v.equals("false")) {
throw new IllegalArgumentException("Boolean cell must be true or false, got: " + cell);
} Try / catch
try {
EasyExcel.read(file, listener).sheet().doRead();
} catch (IllegalArgumentException e) {
if (e.getMessage().startsWith("Unable to parse boolean value")) {
// point user at the offending cell and the allowed values true/false
}
} Prevention
- Use exactly true/false (any capitalization) in Boolean columns.
- Never use 1/0, yes/no, or localized words in Boolean columns.
- Check the field type is actually Boolean before entering truthy text.
When it happens
Trigger: A cell mapped to a field of type Boolean contains values such as "1"/"0", "yes"/"no", "TRUE "/" is not the issue (trimmed) but "Y", "是", or any localized truthy string; a numeric Excel cell formatted as 1/0 read as "1.0".
Common situations: Users type 1/0 or yes/no in the boolean column; Excel displays TRUE/FALSE but stores a localized form; copy-pasted values with hidden characters.
Understand the failure class
Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
Related errors
- -40008
- Header mismatch! Expected headers: , Actual headers:
- RESPONSE_FAILED
- No valid data in file, please check if excel data is…
- DATABASE_TABLE_FIELD_IMPORT_DEFAULT
AI-assisted analysis of iflytek/astron-agent@5e758547a8 (2026-09-12).
Data as JSON: /api/errors/f78bdab65cd435b2.
Report an issue: GitHub.
Appendix: source
Thrown at console/backend/toolkit/src/main/java/com/iflytek/astron/console/toolkit/service/database/DBExcelReadListener.java:193
return ""; // String gives empty string more friendly
}
}
}
private Boolean parseBoolean(String s) {
String x = s.trim().toLowerCase(Locale.ROOT);
// Support various true values (case-insensitive)
if (x.equals("true")) {
return Boolean.TRUE;
}
// Support various false values (case-insensitive)
if (x.equals("false")) {
return Boolean.FALSE;
}
throw new IllegalArgumentException("Unable to parse boolean value: '" + s);
}
}
View on GitHub (pinned to 5e758547a8)