{"record":{"id":"36f64b696d2eca02","repo":"karatelabs/karate","slug":"callsingle-disk-cache-skipped-not-json-like-at","errorCode":null,"errorMessage":"[callSingle] disk cache skipped (not JSON-like at {}): {}","messagePattern":"\\[callSingle\\] disk cache skipped \\(not JSON-like at (.+?)\\): (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"info","filePath":"karate-core/src/main/java/io/karatelabs/core/ScenarioRuntime.java","lineNumber":788,"sourceCode":"                }\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    /**\n     * Internal execution of callSingle - reads and evaluates the file.\n     * Supports:\n     * - ?suffix syntax for cache key differentiation (suffix is stripped for file read)","sourceCodeStart":770,"sourceCodeEnd":806,"githubUrl":"https://github.com/karatelabs/karate/blob/a22eb90246d958d15a47bf436693d0121ad2812d/karate-core/src/main/java/io/karatelabs/core/ScenarioRuntime.java#L770-L806","documentation":"callSingle completed and produced a result, but the result was deemed not JSON-like, so Karate skipped writing it to the disk cache. Only JSON-compatible objects can be persisted; results like Java objects, binaries, or other non-map/list values are cached in memory only. This warning indicates reduced caching effectiveness, not a failure.","triggerScenarios":"The callSingle result object fails the JSON-like check (notJsonLike non-zero) in ScenarioRuntime's disk-cache path, so the write branch is skipped.","commonSituations":"Called feature (or its configure/return) yields a Java object, byte array, or custom type; feature returns a variable set containing non-serializable values; version changes made the JSON-like detection stricter.","solutions":["Make the called feature return plain JSON: maps/lists of primitives instead of Java objects or binary data.","Convert non-JSON results explicitly (e.g. karate.toJson or build the response as JSON in the feature).","Accept the warning if the result is intentionally non-JSON — in-memory caching still applies.","If the result should be JSON, log/inspect the returned value to find which member is not serializable."],"exampleFix":"// before (called feature ends with)\n* def result = javaConfig.buildObject()\n// after\n* def result = { token: javaConfig.getToken(), expiry: javaConfig.getExpiry() }","handlingStrategy":"validation","validationCode":"// verify the callSingle result is JSON-like before caching expectations\nif (!(result instanceof Map || result instanceof List)) skipDiskCache(result);","typeGuard":"boolean isJsonLike(Object o) { return o instanceof Map || o instanceof List || o instanceof String || o instanceof Number || o instanceof Boolean; }","tryCatchPattern":null,"preventionTips":["Design called features to return plain JSON structures.","Convert Java/binary results to maps/lists before returning.","Treat this warning as a hint to review what callSingle returns."],"tags":["callsingle","disk-cache","serialization"],"backgroundTag":"json-serialization-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"}