{"record":{"id":"3c86aed415006e25","repo":"karatelabs/karate","slug":"ext-name-key-points-at-missing-resource-base-path","errorCode":null,"errorMessage":"ext '<name>': <key> points at missing resource: <BASE><path>","messagePattern":"ext '<name>': <key> points at missing resource: <BASE><path>","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"critical","filePath":"karate-core/src/main/java/io/karatelabs/core/ReportAssets.java","lineNumber":224,"sourceCode":"    }\n\n    private void copyResource(String path, Path target) throws IOException {\n        try (InputStream is = classLoader.getResourceAsStream(BASE + path)) {\n            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":206,"sourceCodeEnd":236,"githubUrl":"https://github.com/karatelabs/karate/blob/a22eb90246d958d15a47bf436693d0121ad2812d/karate-core/src/main/java/io/karatelabs/core/ReportAssets.java#L206-L236","documentation":"ReportAssets.requireResource validates at Suite boot that each declared js/css/asset path exists as a classpath resource under the BASE prefix. If getResourceAsStream returns null, the spec points at a resource that is not on the classpath, and the Suite fails at boot.","triggerScenarios":"validateAndBind() with a js/css/asset path whose BASE + path does not resolve on the classpath — wrong path, missing file in src/main/resources, or file not copied into the build output.","commonSituations":"Typo in the resource path; resource in src/test/resources while the suite runs with only main resources; missing <resources> or sourceSets config; path missing the required BASE prefix (e.g. forgot 'ext/' style prefix handled by BASE).","solutions":["Check the exact path exists on the classpath: getClass().getClassLoader().getResource(BASE + path)","Fix the path in the ReportAssets spec (paths are relative to BASE — see the message for the resolved full path)","Move the file into the correct resources folder and rebuild","If in a jar dependency, confirm the jar is on the runtime classpath"],"exampleFix":"// before\nReportAssets.named(\"my-ext\").js(\"myext.js\")\n// after (file actually lives at BASE/ext/myext.js)\nReportAssets.named(\"my-ext\").js(\"ext/myext.js\")","handlingStrategy":"validation","validationCode":"ClassLoader cl = Thread.currentThread().getContextClassLoader();\nfor (String p : List.of(jsPath, cssPath)) {\n    if (cl.getResource(\"report/\" + p) == null) throw new IllegalStateException(\"missing report resource: \" + p);\n}","typeGuard":null,"tryCatchPattern":"try { suiteBoot(); } catch (RuntimeException e) { if (e.getMessage().contains(\"points at missing resource\")) { log.error(\"Fix ReportAssets path; message shows the resolved BASE+path: {}\", e.getMessage()); } throw e; }","preventionTips":["Keep report assets under a fixed resources folder included in build resources","Unit-test validateAndBind against the production classloader","Use the full BASE+path printed in the message to locate the expected location"],"tags":["reporting","classpath","validation","resources","boot-failure"],"backgroundTag":"resource-not-found","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"}