{"record":{"id":"6005337adb23d338","repo":"quarkusio/quarkus","slug":"failed-to-read-comparefile","errorCode":null,"errorMessage":"Failed to read ${compareFile}","messagePattern":"Failed to read (.+?)","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"devtools/maven/src/main/java/io/quarkus/maven/TrackConfigChangesMojo.java","lineNumber":124,"sourceCode":"        if (!prevConfigExists && !dumpCurrentWhenRecordedUnavailable && !dumpDependencies) {\n            getLog().info(\"Config dump from the previous build does not exist at \" + compareFile);\n            return;\n        }\n\n        CuratedApplication curatedApplication = null;\n        QuarkusClassLoader deploymentClassLoader = null;\n        final ClassLoader originalCl = Thread.currentThread().getContextClassLoader();\n        final boolean clearNativeEnabledSystemProperty = setNativeEnabledIfNativeProfileEnabled();\n        try {\n            curatedApplication = bootstrapApplication(launchMode);\n            if (prevConfigExists || dumpCurrentWhenRecordedUnavailable) {\n                final Path targetFile = getOutputFile(outputFile, launchMode.getDefaultProfile(), \"-config-check\");\n                Properties compareProps = new Properties();\n                if (prevConfigExists) {\n                    try (BufferedReader reader = Files.newBufferedReader(compareFile)) {\n                        compareProps.load(reader);\n                    } catch (IOException e) {\n                        throw new RuntimeException(\"Failed to read \" + compareFile, e);\n                    }\n                }\n\n                deploymentClassLoader = curatedApplication.createDeploymentClassLoader();\n                Thread.currentThread().setContextClassLoader(deploymentClassLoader);\n\n                final Class<?> codeGenerator = deploymentClassLoader.loadClass(\"io.quarkus.deployment.CodeGenerator\");\n                final Method dumpConfig = codeGenerator.getMethod(\"dumpCurrentConfigValues\", ApplicationModel.class,\n                        String.class,\n                        Properties.class, QuarkusClassLoader.class, Properties.class, Path.class);\n                dumpConfig.invoke(null, curatedApplication.getApplicationModel(),\n                        launchMode.name(), getBuildSystemProperties(true),\n                        deploymentClassLoader, compareProps, targetFile);\n            }\n\n            if (dumpDependencies) {\n                final List<Path> deps = new ArrayList<>();\n                for (var d : curatedApplication.getApplicationModel().getDependencies(DependencyFlags.DEPLOYMENT_CP)) {","sourceCodeStart":106,"sourceCodeEnd":142,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/devtools/maven/src/main/java/io/quarkus/maven/TrackConfigChangesMojo.java#L106-L142","documentation":"TrackConfigChangesMojo (used by quarkus:dev config-change tracking) reloads the previously saved configuration snapshot (the -config-check properties file) to compare against the current config. If reading that file throws IOException, it wraps it in RuntimeException 'Failed to read <compareFile>'. This means the stored previous-config file exists but cannot be parsed/read.","triggerScenarios":"Prev config file exists (prevConfigExists==true) but Files.newBufferedReader or properties.load fails: corrupted/partial file from a crashed previous run, permission changes, or the file was deleted between the exists() check and the read (TOCTOU race).","commonSituations":"Killed dev process leaving a truncated config-check file; read-only target/ after copying workspaces between users/containers; target/ synced with different ownership (docker volume UID mismatch); antivirus holding the file.","solutions":["Delete the stale file (target/-config-check snapshot in target/) and restart dev mode so it is regenerated","Fix permissions/ownership on the target/ directory","Run `mvn clean` to remove corrupted build state, then rebuild","Exclude target/ from container volume mounts or sync tools that break file consistency"],"exampleFix":"// recovery\nrm -f target/*-config-check*\nmvn clean quarkus:dev","handlingStrategy":"try-catch","validationCode":"// Check the snapshot file is readable and non-truncated before dev runs:\nPath f = Paths.get(\"target\").resolve(\"dev-config-check.properties\");\nif (Files.exists(f) && (!Files.isReadable(f) || Files.size(f) == 0)) Files.delete(f);","typeGuard":null,"tryCatchPattern":"catch (RuntimeException e) {\n  if (e.getMessage() != null && e.getMessage().startsWith(\"Failed to read\")) {\n    Files.deleteIfExists(staleSnapshotPath); // regenerate on next run\n    restartDevMode();\n  } else throw e;\n}","preventionTips":["Use `mvn clean` after a killed/crashed dev session","Exclude target/ from docker volume mounts with mismatched UIDs","Ensure the build directory has consistent ownership/permissions","Don't sync or edit files under target/ externally"],"tags":["maven","quarkus","io"],"backgroundTag":"config-snapshot-corrupt","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}