{"record":{"id":"8dfc1d20adabe16e","repo":"apache/kafka","slug":"failed-to-check-public-api","errorCode":null,"errorMessage":"Failed to check public API: {}","messagePattern":"Failed to check public API: (.+?)","errorType":"exception","errorClass":"GradleException","httpStatus":null,"severity":"error","filePath":"api-checker/gradle-plugins/src/main/java/org/apache/kafka/gradle/KafkaPublicApiCheckerTask.java","lineNumber":131,"sourceCode":"                if (unjustified > 0) {\n                    getLogger().warn(\"{} suppression(s) carry no reason — KIP-1265 requires a justification on every @SuppressKafkaInternalApiUsage\", unjustified);\n                }\n            }\n            if (!violations.isEmpty()) {\n                String message = String.format(\"Found %d public API violations. See report: %s\",\n                    violations.size(), report.getAbsolutePath());\n\n                if (failOnViolation.get()) {\n                    throw new GradleException(message);\n                } else {\n                    getLogger().warn(message);\n                }\n            } else {\n                getLogger().info(\"No public API violations found.\");\n            }\n\n        } catch (IOException e) {\n            throw new GradleException(\"Failed to check public API: \" + e.getMessage(), e);\n        }\n    }\n\n    private File getJavadocJarFile() {\n        if (!javadocJarPath.isPresent()) {\n            throw new GradleException(\"kafkaPublicApiChecker.javadocJarPath is not set. \"\n                    + \"Either configure it explicitly on the extension, or apply this plugin to a \"\n                    + \"project that defines a 'javadocJar' Jar task whose output the plugin can \"\n                    + \"wire automatically.\");\n        }\n        return javadocJarPath.get().getAsFile();\n    }\n\n    @Input\n    public Property<Boolean> getCheckerEnabled() {\n        return enabled;\n    }\n","sourceCodeStart":113,"sourceCodeEnd":149,"githubUrl":"https://github.com/apache/kafka/blob/996fb4585aa1bcc8980b0e1b8d6b168b986cd979/api-checker/gradle-plugins/src/main/java/org/apache/kafka/gradle/KafkaPublicApiCheckerTask.java#L113-L149","documentation":"GradleException wrapping an IOException, thrown from KafkaPublicApiCheckerTask.checkPublicApi's catch block. It signals that reading the javadoc jar, project jars, reference jars, or writing the report failed at the I/O level. The original IOException is the cause.","triggerScenarios":"Any IOException thrown inside the try block at line ~89-130: PublicApiChecker construction/consistency check, or ViolationReporter.writeTextReport. Triggers on unreadable/locked/missing jar or an unwritable report directory.","commonSituations":"Report directory build/reports does not exist or is read-only; javadoc/project jar deleted mid-run; CI runner out of disk; corrupt reference jar in cache.","solutions":["Inspect the wrapped IOException cause for the exact path and reason.","Ensure build/reports/ is writable and the build dir is not read-only.","Re-run ./gradlew clean to regenerate jars and the reports directory consistently.","If a reference jar is corrupt, purge it from the Gradle cache and re-resolve."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Pre-flight: writable report dir and readable jars\ndef reportDir = reportFile.get().asFile.parentFile\nassert reportDir.directory || reportDir.mkdirs(): \"cannot create report dir ${reportDir}\"\n[kafkaJars, projectJarFiles, referenceJarFiles].flatten().each { assert it.canRead(): \"unreadable ${it}\" }","typeGuard":null,"tryCatchPattern":"try { checkPublicApi() } catch (GradleException e) { if (e.cause instanceof IOException) { logger.error('I/O: ' + e.cause.message); /* free disk, fix perms, clean */ } else throw e }","preventionTips":["Ensure build/reports is writable.","Keep adequate free disk on CI runners.","Purge corrupt reference jars from the Gradle cache."],"tags":["gradle","api-checker","io","filesystem"],"backgroundTag":null,"analyzedSha":"996fb4585aa1bcc8980b0e1b8d6b168b986cd979","analyzedAt":"2026-08-11T22:03:28.655Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}