{"record":{"id":"7398d53720642c60","repo":"karatelabs/karate","slug":"expect-to-deep-no-such-api-key","errorCode":null,"errorMessage":"expect().to.deep - no such api: ${key}","messagePattern":"expect\\(\\)\\.to\\.deep - no such api: (.+?)","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"karate-core/src/main/java/io/karatelabs/match/Expect.java","lineNumber":327,"sourceCode":"                Number delta = (Number) args[1];\n                Result result;\n                if (Math.abs(actual.doubleValue() - expected.doubleValue()) <= delta.doubleValue()) {\n                    result = Result.PASS;\n                } else {\n                    result = Result.fail(actual + \" not close to \" + expected + \" ± \" + delta);\n                }\n                handleResult(context, result);\n                return new Expect(subject, false, onResult, throwOnFailure, contextSupplier);\n            };\n            case \"at\" -> expectToBeAt;\n            default -> throw new RuntimeException(\"expect().to.be - no such api: \" + key);\n        };\n    }\n\n    private SimpleObject initExpectToDeep() {\n        return key -> switch (key) {\n            case \"include\" -> match(Match.Type.CONTAINS_DEEP);\n            default -> throw new RuntimeException(\"expect().to.deep - no such api: \" + key);\n        };\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    private SimpleObject initExpectToHaveAll() {\n        return key -> switch (key) {\n            case \"keys\" -> (JavaCallable) (context, args) -> {\n                Result result;\n                if (subject instanceof Map<?, ?> map) {\n                    result = evaluate(map.keySet(), Match.Type.CONTAINS, args[0]);\n                } else {\n                    result = Result.fail(\"not an object\");\n                }\n                handleResult(context, result);\n                return new Expect(subject, false, onResult, throwOnFailure, contextSupplier);\n            };\n            default -> throw new RuntimeException(\"expect().to.have.all - no such api: \" + key);\n        };","sourceCodeStart":309,"sourceCodeEnd":345,"githubUrl":"https://github.com/karatelabs/karate/blob/a22eb90246d958d15a47bf436693d0121ad2812d/karate-core/src/main/java/io/karatelabs/match/Expect.java#L309-L345","documentation":"Unknown-API guard in the expect().to.deep chain: the chained property name after .deep is not one of the supported deep-match APIs (e.g. include). Fires on a typo or unsupported key in the chai-like expect DSL; message interpolates the bad key.","triggerScenarios":"expect(obj).to.deep.<key>(...) with key != 'include', e.g. expect(obj).to.deep.equal(...) or .to.deep.contain.","commonSituations":"Chai habits where .deep.equal exists; in Karate plain .to.equal already does deep equality so .to.deep.equal is unnecessary and invalid.","solutions":["Use expect(obj).to.include(expected) for deep containment","Use expect(obj).to.equal(expected) for full deep equality — Karate's equals is already deep","Use match == for full structural comparison"],"exampleFix":"// before\nexpect(response).to.deep.equal(expected) // no such api: equal\n// after\nexpect(response).to.equal(expected)","handlingStrategy":"validation","validationCode":"if (key !== 'include') throw 'only .to.deep.include is supported, got: ' + key;","typeGuard":null,"tryCatchPattern":"try { expect(obj).to.deep.include(expected); } catch (e) { karate.log(e.message); }","preventionTips":["Remember: Karate's .to.equal is already deep equality — no .deep.equal needed","Use .to.deep.include for deep partial containment","Avoid transplanting Chai's .deep modifier onto other verbs"],"tags":["expect","unsupported-key","deep-equality"],"backgroundTag":"invalid-enum-value","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"}