projectlombok/lombok · error · InvalidCommandLineException

Cannot obtain canonical path to parent directory

Error message

Cannot obtain canonical path to parent directory

What it means

CreateEclipseDebugTarget builds an Eclipse launch configuration file and needs the canonical path of the parent directory ('..'). If File.getCanonicalPath() throws IOException, it throws InvalidCommandLineException with this message.

Solutions

  1. Run the tool from an existing, valid working directory
  2. Check that the parent directory exists and is readable
  3. Inspect the wrapped IOException cause for the real reason
  4. Avoid symlinked or network mounts if canonicalization keeps failing
Defensive patterns

Strategy: validation

Validate before calling

File parent = new File("..");
if (!parent.exists()) throw new IllegalStateException("cwd/parent missing; cd to a valid directory first");

Try / catch

try { tool.go(); } catch (InvalidCommandLineException e) { if (e.getMessage().contains("canonical path")) { log("Run from a valid, existing directory"); } throw e; }

Prevention

When it happens

Trigger: Running the lombok eclipse debug-target creation tool from a directory whose '..' cannot be resolved canonically (deleted cwd, IO failure resolving symlinks).

Common situations: Invoking the tool from a removed working directory, unusual mounts, or permission-restricted filesystems.

Related errors


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

Appendix: source

Thrown at src/support/lombok/eclipseCreate/CreateEclipseDebugTarget.java:93

			launchContent.append("\t<listAttribute key=\"org.eclipse.debug.ui.favoriteGroups\">\n");
			launchContent.append("\t\t<listEntry value=\"org.eclipse.debug.ui.launchGroup.debug\"/>\n");
			launchContent.append("\t</listAttribute>\n");
		}
		
		launchContent.append("\t<stringAttribute key=\"org.eclipse.jdt.junit.CONTAINER\" value=\"\"/>\n");
		launchContent.append("\t<booleanAttribute key=\"org.eclipse.jdt.junit.KEEPRUNNING_ATTR\" value=\"false\"/>\n");
		launchContent.append("\t<stringAttribute key=\"org.eclipse.jdt.junit.TESTNAME\" value=\"\"/>\n");
		launchContent.append("\t<stringAttribute key=\"org.eclipse.jdt.junit.TEST_KIND\" value=\"org.eclipse.jdt.junit.loader.junit4\"/>\n");
		launchContent.append("\t<booleanAttribute key=\"org.eclipse.jdt.launching.ATTR_USE_START_ON_FIRST_THREAD\" value=\"true\"/>\n");
	}
	
	private void classpath() throws InvalidCommandLineException {
		launchContent.append("\t<listAttribute key=\"org.eclipse.jdt.launching.CLASSPATH\">\n");
		
		String self; try {
			self = new File("..").getCanonicalPath();
		} catch (IOException e) {
			throw new InvalidCommandLineException("Cannot obtain canonical path to parent directory", e);
		}
		
		String bootpath = getBootPath();
		
		launchContent.append("\t\t<listEntry value=\"&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#10;&lt;runtimeClasspathEntry internalArchive=&quot;/lombok/bin/main&quot; path=&quot;3&quot; type=&quot;2&quot;/&gt;&#10;\"/>\n");
		for (Map.Entry<String, String> entry : args.entrySet()) {
			if (!entry.getKey().startsWith("conf.")) continue;
			String v = entry.getValue();
			if (v.equals("NONE")) continue;
			String[] files = v.split(Pattern.quote(File.pathSeparator));
			for (String file : files) {
				String n;
				try {
					n = new File(file).getCanonicalPath();
				} catch (IOException e) {
					throw new InvalidCommandLineException("Cannot obtain canonical path to dependency " + file, e);
				}
				if (n.startsWith(self)) {

View on GitHub (pinned to 6d6a3e9fec)