{"record":{"id":"2ce5ac0b120ede92","repo":"apple/pkl","slug":"no-project-directories-specified","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/ProjectPackageTask.java","lineNumber":85,"sourceCode":"  @Optional\n  public abstract Property<Boolean> getInstall();\n\n  @Input\n  @Optional\n  public abstract Property<String> getTestReporter();\n\n  public ProjectPackageTask() {\n    this.getJunitAggregateSuiteName().convention(\"pkl-tests\");\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\n    new CliProjectPackager(\n            getCliBaseOptions(),\n            projectDirectories,\n            new CliTestOptions(\n                mapAndGetOrNull(getJunitReportsDir(), it -> it.getAsFile().toPath()),\n                getOverwrite().get(),\n                getJunitAggregateReports().getOrElse(false),\n                getJunitAggregateSuiteName().get(),\n                toTestReporter(getTestReporter())),\n            getOutputPath().get().getAsFile().getAbsolutePath(),\n            getSkipPublishCheck().getOrElse(false),\n            getInstall().getOrElse(false),\n            new PrintWriter(System.out),\n            new PrintWriter(System.err))\n        .run();\n  }","sourceCodeStart":67,"sourceCodeEnd":103,"githubUrl":"https://github.com/apple/pkl/blob/f3efcbfc9b60d30053b0536d664948d7aa1b8673/pkl-gradle/src/main/java/org/pkl/gradle/task/ProjectPackageTask.java#L67-L103","documentation":"ProjectPackageTask packages Pkl projects; doRunTask maps the configured projectDirectories files to Paths and throws InvalidUserDataException when the list is empty. Packaging needs at least one project directory to produce an artifact, so an empty configuration is rejected up front.","triggerScenarios":"Running the pklPackage task with `projectDirectories` not set (or set to an empty set/files collection) in the task or pkl extension configuration.","commonSituations":"Forgot to add projectDirectories in build.gradle.kts; passed a FileCollection that resolves to nothing (bad pattern/excluded files); running the packaging task in a subproject with no Pkl projects.","solutions":["Set projectDirectories on the task/extension, e.g. `projectDirectories = files(\".\")` or the directories containing PklProject files.","Verify the configured paths actually resolve to existing files (an empty FileCollection triggers the same error).","Check the task is being configured in the project where it runs.","Disable/skip the task if packaging is not needed for that module."],"exampleFix":"// before\nval pklPackage by tasks.existing(PklProjectPackageTask::class)\n// after\ntasks.withType<PklProjectPackageTask>().configureEach { projectDirectories = files(\".\") }","handlingStrategy":"validation","validationCode":"val dirs = task.projectDirectories.files\nrequire(dirs.isNotEmpty()) { \"pklPackage requires projectDirectories; got ${dirs.size}\" }\ndirs.forEach { require(it.resolve(\"PklProject\").exists()) { \"No PklProject in ${it}\" } }","typeGuard":"fun PklProjectPackageTask.hasDirectories() = projectDirectories.files.isNotEmpty()","tryCatchPattern":"try { pkgTask.doRunTask() } catch (InvalidUserDataException e) { if (e.message == \"No project directories specified.\") logger.error(\"Set projectDirectories = files(...)\"); throw e }","preventionTips":["Always configure projectDirectories = files(\".\") or explicit dirs","Verify configured FileCollections resolve to existing dirs","Centralize packaging config in a convention plugin","Run packaging tasks only in modules that contain PklProject files"],"tags":["gradle","pkl","packaging","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"}