{"record":{"id":"dcf625147d682f03","repo":"karatelabs/karate","slug":"failed-to-copy-ext-assets-for","errorCode":null,"errorMessage":"Failed to copy ext assets for '{}': {}","messagePattern":"Failed to copy ext assets for '(.+?)': (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"karate-core/src/main/java/io/karatelabs/output/HtmlReportWriter.java","lineNumber":617,"sourceCode":"        return s.replace(\"&\", \"&amp;\")\n                .replace(\"<\", \"&lt;\")\n                .replace(\">\", \"&gt;\")\n                .replace(\"\\\"\", \"&quot;\");\n    }\n\n    /**\n     * Copy each registered ext's declared assets into {@code outputDir/ext/<name>/}.\n     * Best-effort per ext: a copy failure for one ext is logged and the rest proceed.\n     */\n    private static void copyExtAssets(Map<String, ReportAssets> reportAssets, Path outputDir) {\n        if (reportAssets == null || reportAssets.isEmpty()) {\n            return;\n        }\n        for (ReportAssets assets : reportAssets.values()) {\n            try {\n                assets.copyTo(outputDir.resolve(\"ext\").resolve(assets.name()));\n            } catch (Exception e) {\n                logger.warn(\"Failed to copy ext assets for '{}': {}\", assets.name(), e.getMessage());\n            }\n        }\n    }\n\n    // ========== Template and Resource Loading ==========\n\n    private static String loadTemplate(String name) throws IOException {\n        return loadClasspathResource(RESOURCE_ROOT + name, true);\n    }\n\n    /**\n     * Read a UTF-8 classpath resource. When {@code required} is true a missing\n     * resource raises; otherwise the empty string is returned.\n     */\n    private static String loadClasspathResource(String path, boolean required) throws IOException {\n        try (InputStream is = HtmlReportWriter.class.getClassLoader().getResourceAsStream(path)) {\n            if (is == null) {\n                if (required) {","sourceCodeStart":599,"sourceCodeEnd":635,"githubUrl":"https://github.com/karatelabs/karate/blob/a22eb90246d958d15a47bf436693d0121ad2812d/karate-core/src/main/java/io/karatelabs/output/HtmlReportWriter.java#L599-L635","documentation":"copyExtAssets() copies each registered ReportAssets bundle (custom JS/CSS assets contributed for the report) into <outputDir>/ext/<name>. Per-asset failures are caught individually and logged, so one broken asset does not prevent other report output.","triggerScenarios":"Exception from assets.copyTo(outputDir.resolve(\"ext\").resolve(assets.name())) during writeSummaryPages — asset source files missing from the classpath, target directory not writable, or name/path conflicts in the ext folder.","commonSituations":"Custom report assets registered via an extension but packaged incorrectly (excluded from the jar); read-only output directory; file name from assets.name() colliding with a directory or containing invalid path characters.","solutions":["Confirm the ReportAssets source files are on the classpath and not filtered out by the build","Check that <outputDir>/ext is creatable/writable and no file occupies a needed directory path","Validate assets.name() contains only safe path characters","Enable debug logging or run a minimal suite to isolate which asset fails"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"for (ReportAssets a : reportAssets.values()) {\n    if (getClass().getResource(a.classpathSource()) == null)\n        logger.warn(\"ext asset missing from classpath: {}\", a.name());\n}\nif (!Files.isWritable(outputDir)) throw new IllegalStateException(\"output dir not writable\");","typeGuard":null,"tryCatchPattern":"try {\n    assets.copyTo(outputDir.resolve(\"ext\").resolve(assets.name()));\n} catch (Exception e) {\n    logger.warn(\"Failed to copy ext assets for '{}': {}\", assets.name(), e.getMessage(), e);\n}","preventionTips":["Package custom report assets in the jar (verify with jar tf)","Restrict asset names to filesystem-safe characters","Check ext/ for stale files or name collisions between runs"],"tags":["reporting","filesystem","assets","classpath"],"backgroundTag":"file-write-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"}