{"record":{"id":"f252ed48c1382de1","repo":"karatelabs/karate","slug":"callsingle-disk-cache-write-failed","errorCode":null,"errorMessage":"[callSingle] disk cache write failed: {} - {}","messagePattern":"\\[callSingle\\] disk cache write failed: (.+?) - (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"karate-core/src/main/java/io/karatelabs/core/ScenarioRuntime.java","lineNumber":785,"sourceCode":"                    logger.warn(\"[callSingle] caching exception for: {} - {}\", path, e.getMessage());\n                    cache.put(path, new CallSingleException(e));\n                    throw e;\n                }\n\n                long execTime = System.currentTimeMillis() - startExec;\n                logger.info(\"[callSingle] << executed in {}ms: {}\", execTime, path);\n\n                // Write to disk cache if configured and result is JSON-like\n                if (cacheMinutes > 0 && cacheFile != null) {\n                    String notJsonLike = Json.isMapOrList(result) ? findNonJsonValue(result, \"$\") : \"the result itself\";\n                    if (notJsonLike == null) {\n                        try {\n                            cacheFile.getParentFile().mkdirs();\n                            String json = StringUtils.formatJson(result, false, false, false);\n                            Files.writeString(cacheFile.toPath(), json);\n                            logger.info(\"[callSingle] disk cache write: {}\", cacheFile);\n                        } catch (IOException e) {\n                            logger.warn(\"[callSingle] disk cache write failed: {} - {}\", cacheFile, e.getMessage());\n                        }\n                    } else {\n                        logger.warn(\"[callSingle] disk cache skipped (not JSON-like at {}): {}\", notJsonLike, path);\n                    }\n                }\n            }\n\n            // Cache in memory\n            cache.put(path, result);\n            logger.debug(\"[callSingle] memory cached: {}\", path);\n\n            return StepUtils.deepCopy(result);\n        } finally {\n            lock.unlock();\n        }\n    }\n\n    /**","sourceCodeStart":767,"sourceCodeEnd":803,"githubUrl":"https://github.com/karatelabs/karate/blob/a22eb90246d958d15a47bf436693d0121ad2812d/karate-core/src/main/java/io/karatelabs/core/ScenarioRuntime.java#L767-L803","documentation":"After a successful callSingle execution, Karate attempted to persist the JSON-like result to the disk cache but an IOException occurred while creating directories or writing the file. The run continues — the result is still cached in memory and returned — only cross-JVM/next-run caching is lost for this entry.","triggerScenarios":"Files.writeString or cacheFile.getParentFile().mkdirs() throws IOException in ScenarioRuntime's callSingle disk-cache write path (read-only directory, missing permissions, disk full).","commonSituations":"CI container with read-only target/; running from a JAR with cwd not writable; disk quota exceeded; multiple concurrent JVMs racing on the cache directory.","solutions":["Check the '{}' detail (I/O error) and fix filesystem access: make the cache directory writable or free disk space.","Point the callSingle cache to a writable location (working directory / temp dir the user can write).","Pre-create the cache directory with correct permissions in CI before the run.","Ignore the warning if disk persistence is not needed — in-memory caching still works."],"exampleFix":"// before\ncache dir: target/karate.callSingle (read-only in CI)\n// after\nchmod -R u+w target/ || export KARATE_CALLSINGLE_DIR=/tmp/karate-cache","handlingStrategy":"fallback","validationCode":"File dir = cacheFile.getParentFile();\nif (!dir.canWrite()) logger.warn(\"cache dir not writable: {}\", dir);","typeGuard":null,"tryCatchPattern":"try { Files.writeString(cacheFile.toPath(), json); } catch (IOException e) { logger.warn(\"[callSingle] disk cache write failed: {} - {}\", cacheFile, e.getMessage()); /* proceed with in-memory cache */ }","preventionTips":["Provision a writable cache directory in CI containers.","Monitor disk quota/space on build agents.","Pre-create the cache directory with correct permissions."],"tags":["callsingle","disk-cache","io"],"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-19T12:17:13.211Z"}