apple/pkl · error · CliException
missingProjectInPackageCommand
missingProjectInPackageCommand
Error message
ErrorMessages.create("missingProjectInPackageCommand", proj.projectDir, projectDir) What it means
Thrown by CliProjectPackager.doRun as a consistency check: every local project dependency referenced by any project being packaged must itself be included in the same `pkl project package` invocation. The code walks each project's localDependencies(), computes each dependency's project directory, and throws missingProjectInPackageCommand (with the depending project's dir and the missing dep's dir) if no packaged project matches that directory.
Source
Thrown at pkl-cli/src/main/kotlin/org/pkl/cli/CliProjectPackager.kt:74
override fun doRun() {
val projects = buildList {
for (projectFile in normalizedProjectFiles) {
val project = loadProject(projectFile)
project.`package`
?: throw CliException(
ErrorMessages.create("noPackageDefinedByProject", project.projectFileUri)
)
runApiTests(project)
add(project)
}
}
// Require that all local projects are included
projects.forEach { proj ->
proj.dependencies.localDependencies().values.forEach { localDep ->
val projectDir = Path.of(localDep.projectFileUri()).parent
if (projects.none { it.projectDir == projectDir }) {
throw CliException(
ErrorMessages.create("missingProjectInPackageCommand", proj.projectDir, projectDir)
)
}
}
}
ProjectPackager(
projects,
cliOptions.normalizedWorkingDir,
outputPath,
stackFrameTransformer,
cliOptions.color?.hasColor() ?: false,
securityManager,
httpClient,
skipPublishCheck,
install,
moduleCacheDir,
consoleWriter,
)View on GitHub (pinned to f3efcbfc9b)
Solutions
- Pass ALL mutually dependent local project directories (or their PklProject files) to `pkl project package`
- Add the missing dependency project to your packaging script/CI command
- If the dependency should be external instead of local, adjust the dependency declarations so it is no longer a local project dependency
Example fix
// before pkl project package ./app // after (app depends on ./lib) pkl project package ./app ./lib
Defensive patterns
Strategy: validation
Prevention
- Always package the full set of interdependent local projects
- Keep one packaging entry point (script/Makefile) listing all project dirs
When it happens
Trigger: Running `pkl project package` with only some of the interdependent local projects listed as arguments, where one packaged project's localDependencies points at a project directory not among the arguments.
Common situations: Packaging a single project out of a monorepo whose projects depend on each other; forgetting to list a sibling project directory on the command line; a newly added local dependency not yet reflected in your packaging script.
Understand the failure class
Background: "not installed", "pip install", "required for": how missing-dependency errors surface across open-source libraries — this error's family across 34 libraries.
Related errors
- packageTestsFailed
- noPackageDefinedByProject
- projectDependenciesLocalDependencyOutOfSync
- projectDependenciesOutOfDateInProject
- unresolvedProjectDependency
AI-assisted analysis of apple/pkl@f3efcbfc9b (2026-09-08).
Data as JSON: /api/errors/1e872ec3d3f1aa41.
Report an issue: GitHub.