{"record":{"id":"8b964561076f0473","repo":"github/copilot-sdk","slug":"builtinplugindirectories-must-contain-only-absolut-8b9645","errorCode":null,"errorMessage":"BuiltinPluginDirectories must contain only absolute paths: + path","messagePattern":"BuiltinPluginDirectories must contain only absolute paths: \\+ path","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"java/sdk/src/main/java/com/github/copilot/rpc/CopilotClientOptions.java","lineNumber":153,"sourceCode":"\n    /**\n     * Sets trusted plugin directories bundled by the host. Every path must be\n     * absolute. When non-empty, the complete set is registered during startup\n     * before sessions can be created.\n     *\n     * @param paths\n     *            absolute plugin directory paths, or {@code null}/empty to disable\n     * @return this options instance for method chaining\n     */\n    public CopilotClientOptions setBuiltinPluginDirectories(List<Path> paths) {\n        if (paths == null || paths.isEmpty()) {\n            this.builtinPluginDirectories = null;\n            return this;\n        }\n        for (Path path : paths) {\n            Objects.requireNonNull(path, \"builtin plugin directory path must not be null\");\n            if (!path.isAbsolute()) {\n                throw new IllegalArgumentException(\n                        \"BuiltinPluginDirectories must contain only absolute paths: \" + path);\n            }\n        }\n        this.builtinPluginDirectories = new ArrayList<>(paths);\n        return this;\n    }\n\n    /**\n     * Gets the extra CLI arguments.\n     * <p>\n     * Returns a shallow copy of the internal array, or {@code null} if no arguments\n     * have been set.\n     *\n     * @return a copy of the extra arguments, or {@code null}\n     */\n    public String[] getCliArgs() {\n        return cliArgs != null ? Arrays.copyOf(cliArgs, cliArgs.length) : null;\n    }","sourceCodeStart":135,"sourceCodeEnd":171,"githubUrl":"https://github.com/github/copilot-sdk/blob/cd8cf15dc3f9e762615790aaed0a771a0f392755/java/sdk/src/main/java/com/github/copilot/rpc/CopilotClientOptions.java#L135-L171","documentation":"CopilotClientOptions.setBuiltinPluginDirectories validates that every supplied Path is absolute before storing it. A relative path would resolve against an unpredictable working directory at client start, so the builder rejects the whole list with IllegalArgumentException naming the offending path.","triggerScenarios":"Calling setBuiltinPluginDirectories with a list containing at least one relative path, e.g. Path.of(\"plugins/builtin\") or Paths.get(\"./ext\"), or paths built from user-relative config strings.","commonSituations":"Config files storing plugin directories relative to a project root; building Paths from CLI args without resolution; environment-dependent working directories making relative paths behave differently across machines.","solutions":["Resolve relative paths against a known base before passing them: path.toAbsolutePath() (or base.resolve(path)).","Check each path with Path.isAbsolute() in your config loader and fail/normalize early.","Anchor config values to a documented base directory (e.g. install dir or $HOME) and document it.","If you intend an empty set, pass an empty collection or null — the builder supports clearing the list."],"exampleFix":"// before\nbuilder.setBuiltinPluginDirectories(List.of(Path.of(\"plugins/builtin\")));\n\n// after\nPath dir = Path.of(\"plugins/builtin\").toAbsolutePath();\nbuilder.setBuiltinPluginDirectories(List.of(dir));","handlingStrategy":"validation","validationCode":"List<Path> safe = paths.stream()\n    .peek(p -> Objects.requireNonNull(p, \"plugin dir must not be null\"))\n    .map(Path::toAbsolutePath)\n    .collect(Collectors.toList());\noptions.setBuiltinPluginDirectories(safe);","typeGuard":"static boolean allAbsolute(List<Path> paths) {\n    return paths != null && paths.stream().allMatch(Objects::nonNull) &&\n           paths.stream().allMatch(Path::isAbsolute);\n}","tryCatchPattern":"try {\n    builder.setBuiltinPluginDirectories(paths);\n} catch (IllegalArgumentException e) {\n    Path bad = Path.of(e.getMessage().substring(e.getMessage().lastIndexOf(': ') + 2));\n    builder.setBuiltinPluginDirectories(List.of(bad.toAbsolutePath()));\n}","preventionTips":["Always call toAbsolutePath() on paths read from config files","Resolve plugin dirs against a documented base directory","Log the working directory at startup to debug relative-path confusion","Validate configured paths once at config load, before client construction"],"tags":["java","config","path","validation"],"backgroundTag":"invalid-config-value","analyzedSha":"cd8cf15dc3f9e762615790aaed0a771a0f392755","analyzedAt":"2026-09-09T18:32:31.973Z","contentChangedAt":"2026-09-09T18:32:31.973Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}