{"record":{"id":"7ecf2c4fbc59cf77","repo":"projectlombok/lombok","slug":"4th-arg-must-be-true-or-false","errorCode":null,"errorMessage":"4th arg must be 'true' or 'false'","messagePattern":"4th arg must be 'true' or 'false'","errorType":"console","errorClass":"AppException","httpStatus":null,"severity":"error","filePath":"src/support/lombok/publish/PublishToBucket.java","lineNumber":42,"sourceCode":"import software.amazon.awssdk.services.s3.model.PutObjectRequest;\nimport software.amazon.awssdk.services.s3.model.S3Object;\n\npublic class PublishToBucket {\n\tprivate static final boolean DEBUG = false;\n\t\n\tprivate static final class AppException extends Exception {\n\t\tAppException(String msg) {\n\t\t\tsuper(msg);\n\t\t}\n\t}\n\t\n\tpublic static void main(String[] args) {\n\t\ttry {\n\t\t\tif (args.length != 4) throw new AppException(\"4 args required: [path to creds file] [path to file root to upload] [target dir in bucket] [delete files to create a perfect copy or not]\");\n\t\t\tboolean delete;\n\t\t\tif (args[3].equalsIgnoreCase(\"true\")) delete = true;\n\t\t\telse if (args[3].equalsIgnoreCase(\"false\")) delete = false;\n\t\t\telse throw new AppException(\"4th arg must be 'true' or 'false'\");\n\t\t\tnew PublishToBucket().go(args[0], args[1], args[2], delete);\n\t\t\tSystem.exit(0);\n\t\t} catch (AppException e) {\n\t\t\tSystem.err.println(e.getMessage());\n\t\t\tSystem.exit(1);\n\t\t}\n\t}\n\t\n\tprivate URI endpoint;\n\tprivate String bucketName;\n\tprivate AwsBasicCredentials creds;\n\t\n\t/**\n\t * @param credsPath path to the creds file; first line in that file is the access key, second line is the secret.\n\t * @param rootPath path to a directory; this directory is replicated into the bucket.\n\t */\n\tprivate void go(String credsPath, String rootPath, String bucketDir, boolean delete) throws AppException {\n\t\treadCreds(Paths.get(credsPath));","sourceCodeStart":24,"sourceCodeEnd":60,"githubUrl":"https://github.com/projectlombok/lombok/blob/6d6a3e9fec0a9555702561fbeb8eac836575116e/src/support/lombok/publish/PublishToBucket.java#L24-L60","documentation":"The 4th argument of PublishToBucket must be the literal string 'true' or 'false' (case-insensitive) controlling whether remote files not in the upload set are deleted. Any other value throws AppException; main prints it and exits 1.","triggerScenarios":"Passing values like 'yes', '1', 'True ' with stray characters, or an empty 4th argument.","commonSituations":"Typing 'yes' instead of 'true', scripts substituting 0/1 booleans, shell expanding an empty variable into an invalid value.","solutions":["Pass exactly 'true' or 'false' as the 4th argument","Normalize the boolean in the calling script before invocation","Validate with args[3].equalsIgnoreCase(\"true\")||args[3].equalsIgnoreCase(\"false\") beforehand"],"exampleFix":"// before\njava ... ./site releases/ yes\n// after\njava ... ./site releases/ true","handlingStrategy":"validation","validationCode":"if (!args[3].equalsIgnoreCase(\"true\") && !args[3].equalsIgnoreCase(\"false\")) {\n  throw new IllegalArgumentException(\"4th arg must be 'true' or 'false', got: \" + args[3]);\n}","typeGuard":"function toDeleteFlag(s) { return s === 'true' ? true : s === 'false' ? false : null; }\n// if null, fix before invoking","tryCatchPattern":"try { PublishToBucket.main(args); } catch (AppException e) { System.err.println(e.getMessage()); System.exit(1); }","preventionTips":["Normalize booleans to 'true'/'false' strings in calling scripts","Never pass yes/no or 0/1 to this tool","Echo arguments in wrapper scripts for verification"],"tags":["java","cli","boolean","publish"],"backgroundTag":"invalid-flag-value","analyzedSha":"6d6a3e9fec0a9555702561fbeb8eac836575116e","analyzedAt":"2026-09-07T23:18:01.841Z","contentChangedAt":"2026-09-07T23:18:01.841Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}