quarkusio/quarkus · error · QuarkusCommandException

Failed to create project: ${message}

Error message

Failed to create project: ${message}

What it means

CreateProjectCommandHandler.execute wraps IOException from generating a standard project (codestart generation, file writes) into QuarkusCommandException('Failed to create project: ' + e.getMessage()).

Source

Thrown at independent-projects/tools/devtools-common/src/main/java/io/quarkus/devtools/commands/handlers/CreateProjectCommandHandler.java:281

                invocation.log().info("selected extensions: \n"
                        + depInfo.getDependencies().stream()
                                .map(e -> "- " + e.getGroupId() + ":" + e.getArtifactId() + "\n")
                                .collect(Collectors.joining()));
            }

            final QuarkusCodestartCatalog catalog = QuarkusCodestartCatalog
                    .fromExtensionsCatalog(invocation.getQuarkusProject().getExtensionsCatalog(),
                            invocation.getQuarkusProject().getCodestartResourceLoaders());
            final CodestartProjectDefinition projectDefinition = catalog.createProject(input);
            projectDefinition.generate(invocation.getQuarkusProject().getProjectDirPath());
            invocation.log()
                    .info("\n-----------\n" + MessageIcons.SUCCESS_ICON + " "
                            + projectDefinition.getRequiredCodestart(CodestartType.PROJECT).getName()
                            + " project has been successfully generated in:\n--> "
                            + invocation.getQuarkusProject().getProjectDirPath().toString() + "\n-----------");

        } catch (IOException e) {
            throw new QuarkusCommandException("Failed to create project: " + e.getMessage(), e);
        }

        return QuarkusCommandOutcome.success();
    }

    private static void setQuarkusProperties(QuarkusCommandInvocation invocation, ExtensionCatalog catalog) {
        var quarkusProps = ToolsUtils.readQuarkusProperties(catalog);
        quarkusProps.forEach((k, v) -> {
            final String name = k.toString();
            if (!invocation.hasValue(name)) {
                invocation.setValue(name, v.toString());
            }
        });
    }

    private List<Extension> computeRequiredExtensions(ExtensionCatalog catalog,
            final Set<String> extensionsQuery, MessageWriter log) throws QuarkusCommandException {
        final List<Extension> extensionsToAdd = computeExtensionsFromQuery(catalog, extensionsQuery, log);

View on GitHub (pinned to e1c734241f)

Solutions

  1. Read the embedded message for the exact IO error
  2. Choose a writable, non-existing (or empty) output directory
  3. Verify parent directory exists or create it first
  4. Check disk space and file locks, then rerun

Example fix

// before
quarkus create app org.acme:demo  # run in read-only dir
// after
cd ~/projects && quarkus create app org.acme:demo
Defensive patterns

Strategy: validation

Validate before calling

Path out = invocation.getQuarkusProject().getProjectDirPath();
if (Files.exists(out)) throw new IllegalStateException("Project dir already exists: " + out);
if (!Files.isWritable(out.getParent())) throw new IllegalStateException("Parent not writable: " + out.getParent());

Type guard

static boolean isSafeTarget(Path dir) {
    return !Files.exists(dir) && Files.isWritable(dir.toAbsolutePath().getParent());
}

Try / catch

try { handler.execute(invocation); } catch (QuarkusCommandException e) { log.error("Project creation failed: " + e.getMessage(), e.getCause()); }

Prevention

When it happens

Trigger: Running 'quarkus create project' when writing the generated project files throws IOException — unwritable target dir, existing conflicting files, or codestart resource load failure.

Common situations: Creating a project in a read-only or non-existent parent directory; rerunning into a directory that already contains a project; antivirus/file locks on Windows.

Related errors


AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05). Data as JSON: /api/errors/17eaa3a753c48fd9. Report an issue: GitHub.