{"record":{"id":"bc6952260ac3d1b8","repo":"karatelabs/karate","slug":"expect-to-have-all-no-such-api","errorCode":null,"errorMessage":"expect().to.have.all - no such api: ","messagePattern":"expect\\(\\)\\.to\\.have\\.all - no such api: ","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"karate-core/src/main/java/io/karatelabs/match/Expect.java","lineNumber":344,"sourceCode":"            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        };\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    private SimpleObject initExpectToHaveAny() {\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_ANY, 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.any - no such api: \" + key);\n        };","sourceCodeStart":326,"sourceCodeEnd":362,"githubUrl":"https://github.com/karatelabs/karate/blob/a22eb90246d958d15a47bf436693d0121ad2812d/karate-core/src/main/java/io/karatelabs/match/Expect.java#L326-L362","documentation":"Unknown-API sentinel in Expect's initExpectToHaveAll: the expect().to.have.all accessor is a switch over API key names (e.g. keys), and this fires when a property not in the switch is accessed after expect(...).to.have.all. The input at fault is the unrecognized key string appended to the message, indicating a typo or unsupported .have.all sub-API.","triggerScenarios":"expect(obj).to.have.all.<key>(...) with an unsupported key, e.g. expect(obj).to.have.all.properties(...) instead of keys, or typos.","commonSituations":"Chai's .to.have.all.keys ported incorrectly with an extra word or misspelling (propties, fields).","solutions":["Use expect(obj).to.have.all.keys(['a','b']) with the exact supported syntax","Alternative: match obj == '{ a: #present, b: #present }' or match obj contains only ...","Check the feature output for the exact offending key shown in the message"],"exampleFix":"// before\nexpect(obj).to.have.all.properties('a','b') // no such api: properties\n// after\nexpect(obj).to.have.all.keys(['a','b'])","handlingStrategy":"validation","validationCode":"if (key !== 'keys') throw 'only .to.have.all.keys is supported, got: ' + key;","typeGuard":"function isMap(v){ return v != null && typeof v === 'object' && !(v instanceof Array); }","tryCatchPattern":"try { expect(obj).to.have.all.keys(['a','b']); } catch (e) { karate.log(e.message); }","preventionTips":["Use the exact phrase .to.have.all.keys(...)","Prefer match contains-only for key-set assertions: match obj contains only { a: '#present' }","Spell-check keys in chained expect calls"],"tags":["expect","unsupported-key","object-keys"],"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"}