{"record":{"id":"ffbefef7b826631c","repo":"NationalSecurityAgency/ghidra","slug":"invalid-bool-for-s-s-only-true-or-false-is-all","errorCode":null,"errorMessage":"Invalid bool for %s: %s. Only true or false is allowed.","messagePattern":"Invalid bool for (.+?): (.+?)\\. Only true or false is allowed\\.","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"Ghidra/Debug/Debugger-rmi-trace/src/main/java/ghidra/app/plugin/core/debug/gui/tracermi/launcher/ScriptAttributesParser.java","lineNumber":210,"sourceCode":"\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\tpublic static final BaseType<Boolean> BOOL = new BaseType<>() {\n\t\t\t@Override\n\t\t\tpublic Class<Boolean> cls() {\n\t\t\t\treturn Boolean.class;\n\t\t\t}\n\n\t\t\t@Override\n\t\t\tpublic Boolean decode(String str) {\n\t\t\t\tBoolean result = switch (str.trim().toLowerCase()) {\n\t\t\t\t\tcase \"true\" -> true;\n\t\t\t\t\tcase \"false\" -> false;\n\t\t\t\t\tdefault -> null;\n\t\t\t\t};\n\t\t\t\tif (result == null) {\n\t\t\t\t\tthrow new IllegalArgumentException(\n\t\t\t\t\t\t\"Invalid bool for %s: %s. Only true or false is allowed.\"\n\t\t\t\t\t\t\t\t.formatted(AT_ENV, str));\n\t\t\t\t}\n\t\t\t\treturn result;\n\t\t\t}\n\t\t};\n\n\t\tpublic static final BaseType<Path> PATH = new BaseType<>() {\n\t\t\t@Override\n\t\t\tpublic Class<Path> cls() {\n\t\t\t\treturn Path.class;\n\t\t\t}\n\n\t\t\t@Override\n\t\t\tpublic Path decode(String str) {\n\t\t\t\treturn Paths.get(str);\n\t\t\t}\n\t\t};","sourceCodeStart":192,"sourceCodeEnd":228,"githubUrl":"https://github.com/NationalSecurityAgency/ghidra/blob/d5f144c24d6bc53c9cbf4448c6d11143e7696206/Ghidra/Debug/Debugger-rmi-trace/src/main/java/ghidra/app/plugin/core/debug/gui/tracermi/launcher/ScriptAttributesParser.java#L192-L228","documentation":"Thrown as IllegalArgumentException by the BOOL BaseType decoder when the trimmed, lower-cased input is neither 'true' nor 'false'. The decoder is strict: values like 1/0, yes/no, on/off are all rejected. The message names AT_ENV (the attribute token context). Usually surfaces wrapped by error 353's ParseException.","triggerScenarios":"Declaring or supplying a bool parameter with a value such as '1', '0', 'yes', 'on', 'enabled', or an empty string. Only the literal words 'true' and 'false' (any case, with surrounding whitespace) pass.","commonSituations":"A script author used 1/0 or yes/no conventions common in other config formats; a template substituted a non-boolean; a copy from a properties file that uses 'on'/'off'.","solutions":["Use the literal 'true' or 'false' (case-insensitive) for bool parameters.","Convert any 1/0, yes/no, on/off values to true/false before declaring them.","Double-check the default value in the @attribute declaration line."],"exampleFix":"# before\n#@env VERBOSE:bool=1   # throws 'Invalid bool ... Only true or false'\n\n# after\n#@env VERBOSE:bool=true","handlingStrategy":"validation","validationCode":"String v = str.trim().toLowerCase();\nif (!v.equals(\"true\") && !v.equals(\"false\")) {\n    throw new IllegalArgumentException(\"Bool must be true/false, got: \" + str);\n}","typeGuard":"boolean isValidBool(String s) {\n    String v = s.trim().toLowerCase();\n    return v.equals(\"true\") || v.equals(\"false\");\n}","tryCatchPattern":null,"preventionTips":["Use only 'true' or 'false' for bool parameters.","Convert 1/0, yes/no, on/off values before declaring them.","Remember the decoder trims and lower-cases, but accepts nothing else."],"tags":["config-parsing","bool-validation","launcher-script","ghidra-debug"],"backgroundTag":null,"analyzedSha":"d5f144c24d6bc53c9cbf4448c6d11143e7696206","analyzedAt":"2026-08-14T01:00:57.564Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}