projectlombok/lombok · error

Unclosed ' in @ file

Error message

Unclosed ' in @ file

What it means

Thrown by readArgsFromFile when the tokenizer of an @ argument file reaches end of input while still inside a single-quoted token (state == 3). It fires when the @ file contains a ' that opens a quoted argument but the quote is never closed before the file ends, so the argument list cannot be tokenized reliably. This is a generic sentinel-style validation error naming the malformed input (an unterminated single-quoted token in the @ file), not a wrapper around any underlying failure.

Solutions

  1. Add the closing single quote for every quoted segment
  2. Avoid apostrophes in argument values, or quote them with double quotes instead: "don't"
  3. Verify the argfile with a plain-text editor showing all quote characters (disable smart quotes)

Example fix

// before (@args.txt)
--src 'C:\Users\john's files
// after (@args.txt)
--src 'C:\Users\john''s files'
Defensive patterns

Strategy: validation

Validate before calling

long c = line.chars().filter(ch -> ch == '\'').count();
if (c % 2 != 0) throw new IllegalArgumentException("Unbalanced single quotes in argfile line: " + line);

Try / catch

try { return delombok.parts(new String[]{"@args.txt"}); } catch (IOException e) { if (e.getMessage().contains("Unclosed '")) { /* repair quotes and retry */ } throw e; }

Prevention

When it happens

Trigger: An @argfile line contains an apostrophe or single-quoted argument that is never closed before end of input, e.g. -d 'C:\my output or an English possessive apostrophe (don't) inside a value.

Common situations: Copy-pasted shell commands with single quotes; prose-like values containing apostrophes (don't, user's) pasted into the argfile; editors auto-correcting or stripping trailing quotes.

Understand the failure class

Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.

Related errors


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

Appendix: source

Thrown at src/delombok/lombok/delombok/Delombok.java:447

				if (c == '\'') {
					state = 1;
					x.add(a.toString());
					a.setLength(0);
					continue;
				}
				a.append(c);
				continue;
			}
		}
		if (state == 1) {
			String aa = a.toString();
			if (!aa.isEmpty()) x.add(aa);
		} else if (state < 0) {
			throw new IOException("Unclosed backslash escape in @ file");
		} else if (state == 2) {
			throw new IOException("Unclosed \" in @ file");
		} else if (state == 3) {
			throw new IOException("Unclosed ' in @ file");
		}
		
		return x.toArray(new String[0]);
	}
	
	public static class InvalidFormatOptionException extends Exception {
		public InvalidFormatOptionException(String msg) {
			super(msg);
		}
	}
	
	public static Map<String, String> formatOptionsToMap(List<String> formatOptions) throws InvalidFormatOptionException {
		boolean prettyEnabled = false;
		Map<String, String> formatPrefs = new HashMap<String, String>();
		for (String format : formatOptions) {
			int idx = format.indexOf(':');
			if (idx == -1) {
				if (format.equalsIgnoreCase("pretty")) {

View on GitHub (pinned to 6d6a3e9fec)