{"record":{"id":"d33b388fade2a790","repo":"projectlombok/lombok","slug":"unclosed-backslash-escape-in-file","errorCode":null,"errorMessage":"Unclosed backslash escape in @ file","messagePattern":"Unclosed backslash escape in @ file","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/delombok/lombok/delombok/Delombok.java","lineNumber":443,"sourceCode":"\t\t\t\ta.append(c);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (state == 3) {\n\t\t\t\tif (c == '\\'') {\n\t\t\t\t\tstate = 1;\n\t\t\t\t\tx.add(a.toString());\n\t\t\t\t\ta.setLength(0);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\ta.append(c);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n\t\tif (state == 1) {\n\t\t\tString aa = a.toString();\n\t\t\tif (!aa.isEmpty()) x.add(aa);\n\t\t} else if (state < 0) {\n\t\t\tthrow new IOException(\"Unclosed backslash escape in @ file\");\n\t\t} else if (state == 2) {\n\t\t\tthrow new IOException(\"Unclosed \\\" in @ file\");\n\t\t} else if (state == 3) {\n\t\t\tthrow new IOException(\"Unclosed ' in @ file\");\n\t\t}\n\t\t\n\t\treturn x.toArray(new String[0]);\n\t}\n\t\n\tpublic static class InvalidFormatOptionException extends Exception {\n\t\tpublic InvalidFormatOptionException(String msg) {\n\t\t\tsuper(msg);\n\t\t}\n\t}\n\t\n\tpublic static Map<String, String> formatOptionsToMap(List<String> formatOptions) throws InvalidFormatOptionException {\n\t\tboolean prettyEnabled = false;\n\t\tMap<String, String> formatPrefs = new HashMap<String, String>();","sourceCodeStart":425,"sourceCodeEnd":461,"githubUrl":"https://github.com/projectlombok/lombok/blob/6d6a3e9fec0a9555702561fbeb8eac836575116e/src/delombok/lombok/delombok/Delombok.java#L425-L461","documentation":"When Delombok reads arguments from an @argfile (delombok @file), it parses each line character by character, tracking backslash escapes and quoted strings with a state machine. State < 0 after the input ends means a backslash started an escape sequence that was never completed, so it throws IOException(\"Unclosed backslash escape in @ file\").","triggerScenarios":"An @argfile line ends with a lone trailing backslash (e.g. -d /path/to\\ or an argument ending in \\), so the parser enters escape state and hits end-of-input without a following character.","commonSituations":"Windows-style paths in argfiles written with backslashes where the last segment ends with a separator; copy-pasted lines ending in '\\'; shell-escaped arguments pasted verbatim into the file.","solutions":["Remove the trailing backslash or follow it with the intended escaped character","Use forward slashes in paths inside the @argfile (Java accepts them on all platforms)","Double backslashes where a literal backslash is wanted: path\\\\to\\\\file"],"exampleFix":"// before (@args.txt)\n-d C:\\output\\\n// after (@args.txt)\n-d C:\\output","handlingStrategy":"validation","validationCode":"for (String line : java.nio.file.Files.readAllLines(argfile)) {\n    if (line.endsWith(\"\\\\\")) throw new IllegalArgumentException(\"Trailing backslash in argfile: \" + line);\n}","typeGuard":null,"tryCatchPattern":"try { return delombok.parts(new String[]{\"@args.txt\"}); } catch (IOException e) { if (e.getMessage().contains(\"Unclosed backslash\")) { /* fix argfile and retry */ } throw e; }","preventionTips":["Use forward slashes in paths inside argfiles","Never end an argfile line with a lone backslash","Double backslashes when a literal backslash is required"],"tags":["delombok","argfile","parsing","io"],"backgroundTag":"invalid-argument-format","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"}