{"record":{"id":"f78bdab65cd435b2","repo":"iflytek/astron-agent","slug":"unable-to-parse-boolean-value","errorCode":null,"errorMessage":"Unable to parse boolean value: '","messagePattern":"Unable to parse boolean value: '","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"console/backend/toolkit/src/main/java/com/iflytek/astron/console/toolkit/service/database/DBExcelReadListener.java","lineNumber":193,"sourceCode":"                    return \"\"; // String gives empty string more friendly\n            }\n        }\n    }\n\n    private Boolean parseBoolean(String s) {\n        String x = s.trim().toLowerCase(Locale.ROOT);\n\n        // Support various true values (case-insensitive)\n        if (x.equals(\"true\")) {\n            return Boolean.TRUE;\n        }\n\n        // Support various false values (case-insensitive)\n        if (x.equals(\"false\")) {\n            return Boolean.FALSE;\n        }\n\n        throw new IllegalArgumentException(\"Unable to parse boolean value: '\" + s);\n    }\n}\n","sourceCodeStart":175,"sourceCodeEnd":196,"githubUrl":"https://github.com/iflytek/astron-agent/blob/5e758547a83371a5a4b29dadf4ac03e8dd527635/console/backend/toolkit/src/main/java/com/iflytek/astron/console/toolkit/service/database/DBExcelReadListener.java#L175-L196","documentation":"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).","triggerScenarios":"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\".","commonSituations":"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.","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."],"exampleFix":"// before\n// cell value: 1  -> Unable to parse boolean value: '1\n// after\n// cell value: true","handlingStrategy":"validation","validationCode":"// validate Boolean cells before import\nString v = cell == null ? \"\" : cell.trim().toLowerCase(Locale.ROOT);\nif (!v.equals(\"true\") && !v.equals(\"false\")) {\n    throw new IllegalArgumentException(\"Boolean cell must be true or false, got: \" + cell);\n}","typeGuard":null,"tryCatchPattern":"try {\n    EasyExcel.read(file, listener).sheet().doRead();\n} catch (IllegalArgumentException e) {\n    if (e.getMessage().startsWith(\"Unable to parse boolean value\")) {\n        // point user at the offending cell and the allowed values true/false\n    }\n}","preventionTips":["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."],"tags":["excel","parsing","boolean","java"],"backgroundTag":"invalid-argument-format","analyzedSha":"5e758547a83371a5a4b29dadf4ac03e8dd527635","analyzedAt":"2026-09-12T08:03:51.356Z","contentChangedAt":"2026-09-12T08:03:51.356Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}