{"record":{"id":"9c74a82db4b2ffd4","repo":"karatelabs/karate","slug":"expect-to-have-nested-no-such-api","errorCode":null,"errorMessage":"expect().to.have.nested - no such api: ","messagePattern":"expect\\(\\)\\.to\\.have\\.nested - no such api: ","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"karate-core/src/main/java/io/karatelabs/match/Expect.java","lineNumber":389,"sourceCode":"                    try {\n                        json = Json.of(subject);\n                    } catch (Exception e) {\n                        Result fail = Result.fail(\"expected to have property: \" + path);\n                        handleResult(context, fail);\n                        return new Expect(subject, false, onResult, throwOnFailure, contextSupplier);\n                    }\n                    Result result;\n                    if (args.length > 1) {\n                        Object actual = json.get(path, null);\n                        result = evaluate(actual, Match.Type.EQUALS, args[1]);\n                    } else {\n                        result = json.pathExists(path) ? Result.PASS : Result.fail(\"expected to have property: \" + path);\n                    }\n                    handleResult(context, result);\n                    return new Expect(subject, false, onResult, throwOnFailure, contextSupplier);\n                };\n            } else {\n                throw new RuntimeException(\"expect().to.have.nested - no such api: \" + key);\n            }\n        };\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    private SimpleObject initExpectToHave() {\n        return key -> switch (key) {\n            case \"not\" -> new Expect(subject, !negated, onResult, throwOnFailure, contextSupplier).expectToHave;\n            case \"that\", \"and\", \"which\" -> this;\n            case \"length\" -> handleChainable(rhs -> {\n                if (rhs instanceof Number n) {\n                    String message = \"actual: \" + subject + \", expected: (length=\" + n + \")\";\n                    if (subject instanceof String s) {\n                        return s.length() == n.intValue() ? null : message;\n                    } else if (subject instanceof Map) {\n                        Map<String, Object> map = (Map<String, Object>) subject;\n                        return n.equals(map.get(\"length\")) ? null : message;\n                    } else if (subject instanceof List<?> l) {","sourceCodeStart":371,"sourceCodeEnd":407,"githubUrl":"https://github.com/karatelabs/karate/blob/a22eb90246d958d15a47bf436693d0121ad2812d/karate-core/src/main/java/io/karatelabs/match/Expect.java#L371-L407","documentation":"Unknown-API sentinel in Expect's initExpectToHaveNested: the expect().to.have.nested accessor is a switch over API key names (e.g. a property path), and this fires when an unsupported property is accessed after expect(...).to.have.nested. The input at fault is the unrecognized key string appended to the message, indicating a typo or unsupported .have.nested sub-API.","triggerScenarios":"expect(obj).to.have.nested.<key>(...) where key != 'property', e.g. .to.have.nested.path('a.b.c') or Chai's .to.have.nested.include(...).","commonSituations":"Chai's nested include plugin syntax copied into Karate; typos like propertie or prop.","solutions":["Use expect(obj).to.have.nested.property('a.b.c') exactly","Or use karate path matching: match obj.a.b == '#present' or json path assertions via match","Confirm key spelling matches 'property'"],"exampleFix":"// before\nexpect(obj).to.have.nested.path('a.b') // no such api: path\n// after\nexpect(obj).to.have.nested.property('a.b')","handlingStrategy":"validation","validationCode":"if (key !== 'property') throw 'only .to.have.nested.property is supported, got: ' + key;","typeGuard":null,"tryCatchPattern":"try { expect(obj).to.have.nested.property('a.b.c'); } catch (e) { karate.log(e.message); }","preventionTips":["Always use .to.have.nested.property('<path>') verbatim","For deep path existence also consider karate.match on the JSON path"],"tags":["expect","unsupported-key","nested-property"],"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"}