{"record":{"id":"232435f3f86b23d7","repo":"apple/pkl","slug":"no-project-directories-specified-232435","errorCode":null,"errorMessage":"No project directories specified.","messagePattern":"No project directories specified\\.","errorType":"validation","errorClass":"InvalidUserDataException","httpStatus":null,"severity":"error","filePath":"pkl-gradle/src/main/java/org/pkl/gradle/task/ProjectResolveTask.java","lineNumber":59,"sourceCode":"  @PathSensitive(PathSensitivity.ABSOLUTE)\n  public Provider<List<File>> getProjectPklFiles() {\n    return getProjectDirectories()\n        .getElements()\n        .map(\n            (files) ->\n                files.stream()\n                    .map((it) -> it.getAsFile().toPath().resolve(\"PklProject\").toFile())\n                    .collect(Collectors.toList()));\n  }\n\n  @Override\n  protected void doRunTask() {\n    var projectDirectories =\n        getProjectDirectories().getFiles().stream()\n            .map(it -> Path.of(it.getAbsolutePath()))\n            .collect(Collectors.toList());\n    if (projectDirectories.isEmpty()) {\n      throw new InvalidUserDataException(\"No project directories specified.\");\n    }\n    new CliProjectResolver(\n            getCliBaseOptions(),\n            projectDirectories,\n            new PrintWriter(System.out),\n            new PrintWriter(System.err))\n        .run();\n  }\n}\n","sourceCodeStart":41,"sourceCodeEnd":69,"githubUrl":"https://github.com/apple/pkl/blob/f3efcbfc9b60d30053b0536d664948d7aa1b8673/pkl-gradle/src/main/java/org/pkl/gradle/task/ProjectResolveTask.java#L41-L69","documentation":"ProjectResolveTask resolves dependencies of Pkl projects; doRunTask converts projectDirectories to Paths and throws InvalidUserDataException if none were specified. Resolution requires at least one project directory whose dependencies can be computed and downloaded.","triggerScenarios":"Running the pklProjectResolve task without configuring projectDirectories (empty files set) on the task or via the pkl extension.","commonSituations":"New project where the resolve task was run before wiring configuration; copy-pasted task setup that dropped the projectDirectories line; CI invoking the task in a subproject lacking configuration.","solutions":["Configure `projectDirectories = files(\"<dir-with-PklProject>\")` on the task or extension.","Confirm the directories contain a PklProject file and resolve non-empty.","Ensure configuration lives in the same subproject as the task execution.","Skip the task (onlyIf) for projects that need no dependency resolution."],"exampleFix":"// before\nval pklResolve by tasks.existing(PklProjectResolveTask::class)\n// after\ntasks.withType<PklProjectResolveTask>().configureEach { projectDirectories = files(rootDir) }","handlingStrategy":"validation","validationCode":"val dirs = task.projectDirectories.files\nrequire(dirs.isNotEmpty()) { \"pklResolve requires projectDirectories\" }","typeGuard":"fun PklProjectResolveTask.hasDirectories() = projectDirectories.files.isNotEmpty()","tryCatchPattern":"try { resolveTask.doRunTask() } catch (InvalidUserDataException e) { if (e.message == \"No project directories specified.\") logger.error(\"Configure projectDirectories for pklProjectResolve\"); throw e }","preventionTips":["Configure projectDirectories in the same build script that applies the plugin","Check that configured paths exist and contain PklProject files","Use onlyIf { projectDirectories.files.isNotEmpty() } to skip gracefully","Document required pkl task inputs in your build convention plugin"],"tags":["gradle","pkl","dependency-resolution","missing-argument"],"backgroundTag":"missing-required-argument","analyzedSha":"f3efcbfc9b60d30053b0536d664948d7aa1b8673","analyzedAt":"2026-09-08T13:10:45.570Z","contentChangedAt":"2026-09-08T13:10:45.570Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}