quarkusio/quarkus · error · GradleException

Failed to persist

Error message

Failed to persist 

What it means

Thrown by ExtensionDescriptorTask.generateQuarkusExtensionDescriptor when writing the quarkus-extension.properties descriptor file (QUARKUS_EXTENSION_FILE_NAME) into the output META-INF directory fails with an IOException. The pretty-printed extObject is serialized with Jackson and written via BufferedWriter; any write failure is wrapped in this GradleException.

Source

Thrown at devtools/gradle/gradle-extension-plugin/src/main/java/io/quarkus/extension/gradle/tasks/ExtensionDescriptorTask.java:367

        if (!extObject.has("description") && projectInfo.containsKey("description")) {
            extObject.put("description", projectInfo.get("description"));
        }

        try {
            ExtensionMetadataValidator.validate(extObject);
        } catch (IOException e) {
            throw new GradleException(e.getMessage(), e.getCause());
        }

        final DefaultPrettyPrinter prettyPrinter = new DefaultPrettyPrinter();
        prettyPrinter.indentArraysWith(DefaultIndenter.SYSTEM_LINEFEED_INSTANCE);

        try (BufferedWriter bw = Files
                .newBufferedWriter(outputMetaInfDirectory.resolve(BootstrapConstants.QUARKUS_EXTENSION_FILE_NAME))) {
            bw.write(getMapper().writer().with(prettyPrinter).writeValueAsString(extObject));
        } catch (IOException e) {
            throw new GradleException(
                    "Failed to persist " + outputMetaInfDirectory.resolve(BootstrapConstants.QUARKUS_EXTENSION_FILE_NAME), e);
        }

        ObjectMapper jsonMapper = getJsonMapper();
        try (BufferedWriter bw = Files
                .newBufferedWriter(outputMetaInfDirectory.resolve(BootstrapConstants.QUARKUS_EXTENSION_JSON_FILE_NAME))) {
            bw.write(jsonMapper.writer().with(prettyPrinter).writeValueAsString(extObject));
        } catch (IOException e) {
            throw new GradleException(
                    "Failed to persist "
                            + outputMetaInfDirectory.resolve(BootstrapConstants.QUARKUS_EXTENSION_JSON_FILE_NAME),
                    e);
        }
    }

    private void computeProjectName(ObjectNode extObject) {
        if (!extObject.has("name")) {
            if (projectInfo.containsKey("name")) {

View on GitHub (pinned to e1c734241f)

Solutions

  1. Make sure outputMetaInfDirectory exists and is writable before running the task (gradle clean then rebuild, fix permissions).
  2. Free disk space if the volume is full.
  3. Ensure no parallel/concurrent Gradle invocation writes the same output directory.
  4. Check for locks by IDEs/AV and exclude the build dir from them.

Example fix

// before: dir never created
extensionDescriptor { outputDirectory = file('build/missing/meta-inf') }
// after: create it in a doFirst
/tasks.named('extensionDescriptor') { doFirst { file('build/missing/meta-inf').mkdirs() } }/
Defensive patterns

Strategy: validation

Validate before calling

def out = outputMetaInfDirectory
if (!out.exists() && !out.mkdirs()) throw new IllegalStateException("Cannot create output dir: $out")
if (!out.canWrite()) throw new IllegalStateException("Output dir not writable: $out")

Prevention

When it happens

Trigger: Files.newBufferedWriter or bw.write(...) throws while creating/writing outputMetaInfDirectory/quarkus-extension.properties — output dir doesn't exist and cannot be created, is read-only, or the existing file is locked.

Common situations: Read-only CI output directories, full disks, two builds racing on the same output directory, or the output directory belonging to another user.

Understand the failure class

Background: "failed to write file", "Could not save figure", "Error saving remote file" — file write failed: causes and fixes across languages and libraries — this error's family across 38 libraries.

Related errors


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