{"record":{"id":"64dba3141f767461","repo":"karatelabs/karate","slug":"is-not-a-property-on","errorCode":null,"errorMessage":". is not a property (on )","messagePattern":"\\. is not a property \\(on \\)","errorType":"exception","errorClass":"JsErrorException","httpStatus":null,"severity":"error","filePath":"karate-js/src/main/java/io/karatelabs/js/JavaUtils.java","lineNumber":129,"sourceCode":"                    } catch (Exception ex) {\n                        throw JsErrorException.typeError(\".\" + name + \" is not a function (called on \" + jsTypeName(clazz) + \")\");\n                    }\n                }\n                // Fall back to method reference\n                for (Method m : clazz.getMethods()) {\n                    if (m.getName().equals(name)) {\n                        JavaType jc = new JavaType(clazz);\n                        return jc.getMethod(name);\n                    }\n                }\n                // Static nested class / enum: e.g. Foo.Bar where Bar is a member type\n                for (Class<?> nested : clazz.getClasses()) {\n                    if (nested.getSimpleName().equals(name)) {\n                        return new JavaType(nested);\n                    }\n                }\n            }\n            throw JsErrorException.typeError(\".\" + name + \" is not a property (on \" + jsTypeName(clazz) + \")\");\n        }\n    }\n\n    private static Method findStaticGetter(Class<?> clazz, String name) {\n        String getterSuffix = name.substring(0, 1).toUpperCase() + name.substring(1);\n        Method method = findStaticMethod(clazz, \"get\" + getterSuffix);\n        if (method == null) {\n            method = findStaticMethod(clazz, \"is\" + getterSuffix);\n        }\n        return method;\n    }\n\n    private static Method findStaticMethod(Class<?> clazz, String name) {\n        for (Method method : clazz.getMethods()) {\n            if (method.getName().equals(name) && Modifier.isStatic(method.getModifiers())\n                    && method.getParameterCount() == 0) {\n                return method;\n            }","sourceCodeStart":111,"sourceCodeEnd":147,"githubUrl":"https://github.com/karatelabs/karate/blob/a22eb90246d958d15a47bf436693d0121ad2812d/karate-js/src/main/java/io/karatelabs/js/JavaUtils.java#L111-L147","documentation":"Thrown by JavaUtils.getStatic when the requested name matches no static field, no static getter method, no static method reference, and no nested class on the Java type. It means the property simply does not exist on the class: '.<name> is not a property (on <TypeName>)'.","triggerScenarios":"Reading ClassName.missingField in a Karate JS block where no such static field/getter/method/nested class exists.","commonSituations":"Typos (Math.PII), assuming constants exist in a different class (Color.RED vs java.awt.Color variants), accessing instance members as static, version drift where a constant moved packages.","solutions":["Verify the exact name of the static field/constant in the class's javadoc.","Check whether the member is instance-level and needs an object instead of the class handle.","Confirm the class/package for the constant hasn't changed across library versions.","Enumerate available members by inspecting the class before access."],"exampleFix":"// before\nvar Math = Java.type('java.lang.Math');\nvar x = Math.pie;\n// after\nvar x = Math.PI;","handlingStrategy":"type-guard","validationCode":"function hasStaticMember(clazz, name) { try { return clazz.getClass().getField(name) != null; } catch (e) { return false; } }","typeGuard":"function safeGetStatic(clazz, name) { try { return clazz[name]; } catch (e) { return undefined; } }","tryCatchPattern":"try { var v = Clz.CONST; } catch (e) { if (String(e).indexOf('not a property') !== -1) { karate.log('constant missing on', Clz); v = fallback; } else { throw e; } }","preventionTips":["Copy constant names from javadoc, not memory","Check whether the member is instance-level, not static","Confirm the owning class/package across library version changes","Use an IDE or javap to enumerate statics before scripting"],"tags":["javascript","java-interop","static-field","property-not-found"],"backgroundTag":"property-not-found","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"}