{"record":{"id":"f2b6993b6692a928","repo":"xpipe-io/xpipe","slug":"development-build-launched-in-wrong-working-direct","errorCode":null,"errorMessage":"Development build launched in wrong working directory, expected project root but got ${cwd}","messagePattern":"Development build launched in wrong working directory, expected project root but got (.+?)","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"app/src/main/java/io/xpipe/app/core/AppInstallation.java","lineNumber":125,"sourceCode":"\n        // Resolve any possible links to a real path\n        Path path = toRealPathIfPossible(Path.of(command.get()));\n        // Check if the process was started using a relative path, and adapt it if necessary\n        if (!path.isAbsolute()) {\n            path = toRealPathIfPossible(Path.of(System.getProperty(\"user.dir\")).resolve(path));\n        }\n\n        var name = path.getFileName().toString();\n        // Check if we launched the JVM via a start script instead of the native executable\n        if (name.endsWith(\"java\") || name.endsWith(\"java.exe\")) {\n            // If we are not an image, we are probably running in a development environment where we want to use the\n            // working directory\n            var isImage = AppProperties.get().isImage();\n            if (!isImage) {\n                var cwd = toRealPathIfPossible(Path.of(System.getProperty(\"user.dir\")));\n                var valid = Files.exists(cwd.resolve(\"app\")) && Files.exists(cwd.resolve(\"lang\"));\n                if (!valid) {\n                    throw new IllegalArgumentException(\n                            \"Development build launched in wrong working directory, expected project root but got \"\n                                    + cwd);\n                }\n                return cwd;\n            }\n            return getInstallationBasePathForJavaExecutable(path);\n        } else {\n            var dir = getInstallationBasePathForLauncherExecutable(path);\n            return toRealPathIfPossible(dir);\n        }\n    }\n\n    private static Path getInstallationBasePathForLauncherExecutable(Path executable) {\n        // Resolve root path of installation relative to executable in a JPackage installation\n        return switch (OsType.ofLocal()) {\n            case OsType.Linux ignored -> {\n                yield executable.getParent().getParent();\n            }","sourceCodeStart":107,"sourceCodeEnd":143,"githubUrl":"https://github.com/xpipe-io/xpipe/blob/d85ca821baa46092a320ebb13546d7240adb74f8/app/src/main/java/io/xpipe/app/core/AppInstallation.java#L107-L143","documentation":"In development mode (not a packaged image), XPipe expects to be launched with the working directory set to the project root, verified by the presence of the 'app' and 'lang' directories. If those directories are not under the current working directory, it cannot resolve resources and throws. This is a launch-environment sanity check in determineCurrentInstallationBasePath.","triggerScenarios":"Starting the app in development mode (isImage() == false) from any directory other than the project root, on Windows/Linux/macOS via determineCurrentInstallationBasePath.","commonSituations":"Running the main class from an IDE whose working directory defaults to the project subdir or $HOME; launching via a script from the wrong cwd; running from inside app/ or a build directory.","solutions":["Set the working directory to the project root before launching (IDE run configuration 'Working directory' field)","If using Gradle, run via the provided run task which sets cwd correctly","Verify cwd contains both 'app' and 'lang' directories before launching"],"exampleFix":"// before (IDE run config)\nWorking directory: $HOME\n// after\nWorking directory: $PROJECT_DIR$","handlingStrategy":"validation","validationCode":"var cwd = Path.of(System.getProperty(\"user.dir\"));\nif (!(Files.exists(cwd.resolve(\"app\")) && Files.exists(cwd.resolve(\"lang\")))) {\n    throw new IllegalStateException(\"Launch from project root, got: \" + cwd);\n}","typeGuard":null,"tryCatchPattern":"try { launch(args); } catch (IllegalArgumentException e) { if (e.getMessage().startsWith(\"Development build launched in wrong working directory\")) { System.err.println(\"cd to project root and relaunch\"); } else throw e; }","preventionTips":["Set IDE run-configuration working directory to $PROJECT_DIR$","Launch through the Gradle run task","Check for 'app' and 'lang' dirs in launch scripts before exec"],"tags":["configuration","working-directory","development-setup"],"backgroundTag":"invalid-working-directory","analyzedSha":"d85ca821baa46092a320ebb13546d7240adb74f8","analyzedAt":"2026-09-06T14:30:08.251Z","contentChangedAt":"2026-09-06T14:30:08.251Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}