projectlombok/lombok · error · AppException

4th arg must be 'true' or 'false'

Error message

4th arg must be 'true' or 'false'

What it means

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.

Solutions

  1. Pass exactly 'true' or 'false' as the 4th argument
  2. Normalize the boolean in the calling script before invocation
  3. Validate with args[3].equalsIgnoreCase("true")||args[3].equalsIgnoreCase("false") beforehand

Example fix

// before
java ... ./site releases/ yes
// after
java ... ./site releases/ true
Defensive patterns

Strategy: validation

Validate before calling

if (!args[3].equalsIgnoreCase("true") && !args[3].equalsIgnoreCase("false")) {
  throw new IllegalArgumentException("4th arg must be 'true' or 'false', got: " + args[3]);
}

Type guard

function toDeleteFlag(s) { return s === 'true' ? true : s === 'false' ? false : null; }
// if null, fix before invoking

Try / catch

try { PublishToBucket.main(args); } catch (AppException e) { System.err.println(e.getMessage()); System.exit(1); }

Prevention

When it happens

Trigger: Passing values like 'yes', '1', 'True ' with stray characters, or an empty 4th argument.

Common situations: Typing 'yes' instead of 'true', scripts substituting 0/1 booleans, shell expanding an empty variable into an invalid value.

Understand the failure class

Background: "unknown output mode", "invalid value for flag", "expects true/false": fixing invalid flag value errors in CLI tools — this error's family across 24 libraries.

Related errors


AI-assisted analysis of projectlombok/lombok@6d6a3e9fec (2026-09-07). Data as JSON: /api/errors/7ecf2c4fbc59cf77. Report an issue: GitHub.

Appendix: source

Thrown at src/support/lombok/publish/PublishToBucket.java:42

import software.amazon.awssdk.services.s3.model.PutObjectRequest;
import software.amazon.awssdk.services.s3.model.S3Object;

public class PublishToBucket {
	private static final boolean DEBUG = false;
	
	private static final class AppException extends Exception {
		AppException(String msg) {
			super(msg);
		}
	}
	
	public static void main(String[] args) {
		try {
			if (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]");
			boolean delete;
			if (args[3].equalsIgnoreCase("true")) delete = true;
			else if (args[3].equalsIgnoreCase("false")) delete = false;
			else throw new AppException("4th arg must be 'true' or 'false'");
			new PublishToBucket().go(args[0], args[1], args[2], delete);
			System.exit(0);
		} catch (AppException e) {
			System.err.println(e.getMessage());
			System.exit(1);
		}
	}
	
	private URI endpoint;
	private String bucketName;
	private AwsBasicCredentials creds;
	
	/**
	 * @param credsPath path to the creds file; first line in that file is the access key, second line is the secret.
	 * @param rootPath path to a directory; this directory is replicated into the bucket.
	 */
	private void go(String credsPath, String rootPath, String bucketDir, boolean delete) throws AppException {
		readCreds(Paths.get(credsPath));

View on GitHub (pinned to 6d6a3e9fec)