{"record":{"id":"187b2946d5faae50","repo":"karatelabs/karate","slug":"failed-to-create-report-directories","errorCode":null,"errorMessage":"Failed to create report directories: {}","messagePattern":"Failed to create report directories: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"karate-core/src/main/java/io/karatelabs/output/HtmlReportListener.java","lineNumber":102,"sourceCode":"    }\n\n    @Override\n    public void onSuiteStart(Suite suite) {\n        suiteStartTime = System.currentTimeMillis();\n        threadCount = suite.threadCount;\n        reportAssets = suite.getReportAssets();\n        this.suite = suite;\n\n        // Embed file names use a 001_, 002_, ... sequence; reset per suite so\n        // numbers don't bleed across runs in the same JVM (e.g. test suites).\n        HtmlReportWriter.resetEmbedCounter();\n\n        // Create directories eagerly\n        try {\n            Files.createDirectories(outputDir.resolve(SUBFOLDER));\n            Files.createDirectories(outputDir.resolve(\"res\"));\n        } catch (Exception e) {\n            logger.warn(\"Failed to create report directories: {}\", e.getMessage());\n        }\n    }\n\n    @Override\n    public void onFeatureEnd(FeatureResult result) {\n        // Sort scenarios for deterministic ordering in reports\n        result.sortScenarioResults();\n\n        // Collect feature data using toJson() format, reduced to what the suite-end pages\n        // actually read. The per-feature HTML below is written from the FeatureResult\n        // itself, so nothing here needs the step detail.\n        featureMaps.add(summaryJson(result));\n\n        // Extract the page model and render it, both here, on the feature's own thread.\n        //\n        // Rendering used to be handed to a single-thread executor with an unbounded queue, on\n        // the reasoning that templating and IO should stay off the hot path. Measured, the\n        // opposite was true: rendering a feature page cost ~3x the suite's entire wall-clock","sourceCodeStart":84,"sourceCodeEnd":120,"githubUrl":"https://github.com/karatelabs/karate/blob/a22eb90246d958d15a47bf436693d0121ad2812d/karate-core/src/main/java/io/karatelabs/output/HtmlReportListener.java#L84-L120","documentation":"WARN log from HtmlReportListener.onSuiteStart when the eager Files.createDirectories calls for the report output folder (subfolder and 'res') fail. The listener continues, and directory creation is likely retried later by the report writer, but early report files may be missing if the underlying cause (permissions, bad path) persists.","triggerScenarios":"Suite start with an outputDir that cannot be created: parent directory missing and uncreatable, no write permission on the parent, outputDir points to an existing regular file, or a read-only filesystem/volume.","commonSituations":"Read-only CI workspace or container filesystem; report path pointing into a nonexistent protected location; outputDir colliding with an existing file; Windows path with invalid characters; disk full.","solutions":["Fix the configured report output directory to a writable, non-existent-as-file location.","Check parent-directory permissions (`ls -ld <parent>`) and disk space.","In containers/CI, mount or create a writable output volume.","Verify no file exists at the same path where the directory must be created."],"exampleFix":"// before: unwritable path in runner\nHtmlReport.handleResult(\"target/surefire-reports\"); // if target/ is read-only\n// after\nHtmlReport.handleResult(System.getProperty(\"java.io.tmpdir\") + \"/karate-report\");","handlingStrategy":"validation","validationCode":"Path out = Path.of(reportDir);\nif (out.toFile().exists() && !out.toFile().isDirectory()) throw new IllegalStateException(\"report path is a file: \" + out);\nif (!Files.isWritable(out.getParent() != null ? out.getParent() : out)) throw new IllegalStateException(\"report dir not writable: \" + out);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Point the report output at a directory guaranteed writable in every environment.","Pre-create the report directory in CI setup with correct permissions.","Never point outputDir at an existing file path.","Ensure the CI volume isn't mounted read-only."],"tags":["html-report","filesystem","permissions","directories"],"backgroundTag":"mkdir-permission-denied","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"}