{"record":{"id":"50ebb373ab2e4786","repo":"projectlombok/lombok","slug":"4-args-required-path-to-creds-file-path-to-fil","errorCode":null,"errorMessage":"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]","messagePattern":"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\\]","errorType":"console","errorClass":"AppException","httpStatus":null,"severity":"error","filePath":"src/support/lombok/publish/PublishToBucket.java","lineNumber":38,"sourceCode":"import software.amazon.awssdk.services.s3.model.DeleteObjectsRequest;\nimport software.amazon.awssdk.services.s3.model.ListObjectsV2Request;\nimport software.amazon.awssdk.services.s3.model.ListObjectsV2Response;\nimport software.amazon.awssdk.services.s3.model.ObjectIdentifier;\nimport 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.","sourceCodeStart":20,"sourceCodeEnd":56,"githubUrl":"https://github.com/projectlombok/lombok/blob/6d6a3e9fec0a9555702561fbeb8eac836575116e/src/support/lombok/publish/PublishToBucket.java#L20-L56","documentation":"PublishToBucket.main requires exactly 4 command-line arguments (credentials file, root to upload, target bucket dir, delete flag). Any other count throws AppException with this usage message; main catches it, prints it to stderr, and exits 1.","triggerScenarios":"Running the publisher with fewer or more than 4 arguments, e.g. omitting the creds path or the delete flag.","commonSituations":"Calling the tool manually with missing args, scripts quoting arguments so they collapse into one, extra stray arguments.","solutions":["Invoke with exactly 4 arguments: credsFile rootDir bucketDir true|false","Quote paths containing spaces so they count as single arguments","Add a wrapper script documenting the 4 required args","Check arg count before calling if invoking programmatically"],"exampleFix":"// before\njava lombok.publish.PublishToBucket creds.json ./site\n// after\njava lombok.publish.PublishToBucket creds.json ./site releases/ true","handlingStrategy":"validation","validationCode":"if (process.argv.length !== 4 + 2) throw new Error('usage: PublishToBucket <credsFile> <rootDir> <bucketDir> <true|false>');","typeGuard":null,"tryCatchPattern":"try { PublishToBucket.main(args); } catch (AppException e) { System.err.println(e.getMessage()); System.exit(1); } // already built into main","preventionTips":["Call the tool via a wrapper script with named parameters","Quote space-containing paths so arg count stays 4","Document the 4-argument contract where the tool is invoked"],"tags":["java","cli","publish","usage"],"backgroundTag":"missing-cli-argument","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"}