{"record":{"id":"15d3b0ff8821feac","repo":"karatelabs/karate","slug":"ext-name-failed-reading-base-path-message","errorCode":null,"errorMessage":"ext '<name>': failed reading <BASE><path> — <message>","messagePattern":"ext '<name>': failed reading <BASE><path> — <message>","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"karate-core/src/main/java/io/karatelabs/core/ReportAssets.java","lineNumber":228,"sourceCode":"            if (is == null) {\n                throw new IOException(\"ext '\" + name + \"': resource vanished after validation: \" + path);\n            }\n            Path parent = target.getParent();\n            if (parent != null) {\n                Files.createDirectories(parent);\n            }\n            Files.copy(is, target, java.nio.file.StandardCopyOption.REPLACE_EXISTING);\n        }\n    }\n\n    private void requireResource(ClassLoader cl, String path, String key) {\n        try (InputStream is = cl.getResourceAsStream(BASE + path)) {\n            if (is == null) {\n                throw new RuntimeException(\"ext '\" + name + \"': \" + key\n                        + \" points at missing resource: \" + BASE + path);\n            }\n        } catch (IOException e) {\n            throw new RuntimeException(\"ext '\" + name + \"': failed reading \" + BASE + path + \" — \" + e.getMessage(), e);\n        }\n    }\n\n    private static String stripStatic(String p) {\n        return p.startsWith(STATIC_PREFIX) ? p.substring(STATIC_PREFIX.length()) : p;\n    }\n}\n","sourceCodeStart":210,"sourceCodeEnd":236,"githubUrl":"https://github.com/karatelabs/karate/blob/a22eb90246d958d15a47bf436693d0121ad2812d/karate-core/src/main/java/io/karatelabs/core/ReportAssets.java#L210-L236","documentation":"requireResource wraps any IOException from reading the classpath resource during validation in a RuntimeException including the underlying message. Unlike the missing-resource case, the lookup itself failed (e.g. a closed/invalid classloader or jar I/O error).","triggerScenarios":"validateAndBind() where cl.getResourceAsStream(BASE + path) throws IOException — corrupted jar, closed classloader, or filesystem-backed classpath entry that disappeared mid-read.","commonSituations":"Jar file corrupted or truncated during a concurrent build; dev-mode classloader closed by a framework restart; NFS/network-mounted classpath entries temporarily unavailable.","solutions":["Inspect the wrapped cause (e.getMessage()) to identify the I/O failure","Rebuild/replace the corrupted jar and restart the JVM","Restart the application server/framework that closed the classloader","Retry after the shared/network filesystem recovers"],"exampleFix":"// after a rebuild, verify the jar is readable before running:\n// jar tf app.jar | grep <BASE><path>\nmvn clean package","handlingStrategy":"try-catch","validationCode":"try (InputStream is = cl.getResourceAsStream(BASE + path)) { /* readable check before validateAndBind */ }","typeGuard":null,"tryCatchPattern":"try { suiteBoot(); } catch (RuntimeException e) { if (e.getMessage().startsWith(\"ext '\")) { log.error(\"report ext resource I/O failed: {}\", e.getCause(), e); } throw e; }","preventionTips":["Don't clean/rebuild jars while the JVM using them is live","Avoid network filesystems for classpath entries in CI","Handle the wrapped IOException cause for diagnostics"],"tags":["reporting","classpath","io","validation"],"backgroundTag":"file-read-failed","analyzedSha":"a22eb90246d958d15a47bf436693d0121ad2812d","analyzedAt":"2026-09-12T09:01:00.220Z","contentChangedAt":"2026-09-12T09:01:00.220Z","schemaVersion":2},"datasetVersion":"2026-09-16T19:17:19.609Z"}