projectlombok/lombok · error

Unclosed " in @ file

Error message

Unclosed " in @ file

What it means

Delombok's @argfile parser tracks whether a double-quoted section opened on a line is closed before end of input. If the state machine ends in state 2, the closing quote is missing and it throws IOException("Unclosed \" in @ file").

Solutions

  1. Ensure every opening double quote in the argfile has a matching closing quote on the same line
  2. Quote the whole argument only when it contains spaces: -d "C:\my output"
  3. Avoid smart/curly quotes (“ ”) — use plain ASCII " and ' in argfiles

Example fix

// before (@args.txt)
--charset "utf-8
// after (@args.txt)
--charset "utf-8"
Defensive patterns

Strategy: validation

Validate before calling

long c = line.chars().filter(ch -> ch == '"').count();
if (c % 2 != 0) throw new IllegalArgumentException("Unbalanced double 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 opening " that is never closed on that logical line, e.g. an argument like --print-stack-modes "verbose or an odd number of quotes, so parsing hits end of input while inside a quoted token.

Common situations: Copy-pasting shell command lines where quotes were consumed or half-pasted; quoting arguments with spaces and losing the closing quote in an editor; smart-quote corruption from rich-text editors.

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/bc5833ded3a6cc75. Report an issue: GitHub.

Appendix: source

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

			}
			if (state == 3) {
				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(':');

View on GitHub (pinned to 6d6a3e9fec)