{"record":{"id":"8f60ea238ca309e9","repo":"quarkusio/quarkus","slug":"could-not-find-project-for","errorCode":null,"errorMessage":"Could not find project for ","messagePattern":"Could not find project for ","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"devtools/gradle/gradle-model/src/main/java/io/quarkus/gradle/tooling/GradleApplicationModelBuilder.java","lineNumber":532,"sourceCode":"                }\n            }\n            if (!isFlagOn(flags, COLLECT_RELOADABLE_MODULES)) {\n                depBuilder.clearFlag(DependencyFlags.RELOADABLE);\n            }\n        }\n\n        if (processChildren) {\n            for (org.gradle.api.artifacts.ResolvedDependency child : resolvedDep.getChildren()) {\n                collectDependencies(child, workspaceDiscovery, project, artifactFiles, modelBuilder, projectModule, flags);\n            }\n        }\n    }\n\n    private void initProjectModuleAndBuildPaths(final Project project,\n            ResolvedArtifact resolvedArtifact, ApplicationModelBuilder appModel, final ResolvedDependencyBuilder appDep) {\n        if (project == null) {\n            System.err.println(\"Error: could not find project for \" + resolvedArtifact.getId().getDisplayName());\n            throw new IllegalStateException(\"Could not find project for \" + resolvedArtifact.getId().getDisplayName());\n        }\n        appDep.setWorkspaceModule().setReloadable();\n\n        if (appDep.getWorkspaceModule() == null) {\n            final WorkspaceModule.Mutable projectModule = appModel.getOrCreateProjectModule(\n                    WorkspaceModuleId.of(resolvedArtifact.getModuleVersion().getId().getGroup(), resolvedArtifact.getName(),\n                            resolvedArtifact.getModuleVersion().getId().getVersion()),\n                    project.getProjectDir(),\n                    project.getLayout().getBuildDirectory().get().getAsFile())\n                    .setBuildFile(project.getBuildFile().toPath());\n            ProjectDescriptorBuilder.initSourceDirs(project, projectModule);\n            appDep.setWorkspaceModule(projectModule);\n        }\n\n        appModel.addReloadableWorkspaceModule(appDep.getKey());\n    }\n\n    private boolean processQuarkusDependency(ResolvedDependencyBuilder artifactBuilder, ApplicationModelBuilder modelBuilder) {","sourceCodeStart":514,"sourceCodeEnd":550,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/devtools/gradle/gradle-model/src/main/java/io/quarkus/gradle/tooling/GradleApplicationModelBuilder.java#L514-L550","documentation":"Thrown by GradleApplicationModelBuilder.initProjectModuleAndBuildPaths as an IllegalStateException when a resolved dependency artifact should correspond to a Gradle project in the current build, but project lookup returned null. A diagnostic message is also printed to System.err with the artifact display name. This means the Quarkus model builder expected the artifact to come from the workspace (a local module) but the resolved artifact cannot be mapped back to any Project in the build.","triggerScenarios":"collectDependencies resolves an artifact that the Quarkus Gradle plugin treats as a workspace module (e.g. a project dependency produced by a composite or included build, or resolved from a local repo cache), then calls initProjectModuleAndBuildPaths, where project == null because findProject did not locate a Project matching the artifact's group/name.","commonSituations":"Composite/included builds where the artifact comes from an included build not visible via project lookup; artifacts with classifier or custom name mapping that breaks group:name matching; stale Gradle caches after renaming a module; dependencies published from another repo with the same coordinates as a local module.","solutions":["Check the artifact display name in the stderr message and confirm a module with that group:name exists in the current Gradle build.","If using composite/included builds, ensure the included build is registered (settings.gradle includeBuild) and its group:name match the dependency.","Clean Gradle caches (./gradlew clean, delete ~/.gradle/caches/modules-2 entries for the artifact) after renaming modules.","Remove duplicate/conflicting coordinate mappings so local modules are referenced as project(':module') dependencies, not external coordinates.","Upgrade the Quarkus Gradle plugin if the mismatch stems from a plugin bug in project-to-artifact resolution."],"exampleFix":"// before (settings.gradle)\n// missing includeBuild for a sibling referenced by coordinates\n// after\nincludeBuild '../my-shared-quarkus-ext'","handlingStrategy":"validation","validationCode":"// Validate local module coordinates match dependency coordinates before building:\nassert project.group == expectedGroup && project.name == expectedName :\n    \"Module coordinates ${project.group}:${project.name} do not match the dependency ${expectedGroup}:${expectedName}\"","typeGuard":null,"tryCatchPattern":"try {\n    quarkusDev()\n} catch (IllegalStateException e) {\n    if (e.message?.startsWith('Could not find project for')) {\n        logger.error('Artifact expected in workspace but not found: ' + e.message)\n    } else throw e\n}","preventionTips":["Reference local modules via project(':module') instead of external coordinates","Register all sibling builds with includeBuild in settings.gradle when using composite builds","After renaming a module, run a clean build and prune stale cache entries","Keep group/name of each subproject consistent with the published coordinates"],"tags":["gradle","quarkus","workspace","dependency-resolution"],"backgroundTag":"artifact-not-in-workspace","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}