{"record":{"id":"9d471b358ed7d6ec","repo":"FasterXML/jackson-databind","slug":"instances-of-should-not-get-visited","errorCode":null,"errorMessage":"Instances of {} should not get visited","messagePattern":"Instances of (.+?) should not get visited","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"src/main/java/tools/jackson/databind/BeanProperty.java","lineNumber":279,"sourceCode":"        @Override public JavaType getType() { return _type; }\n        @Override public PropertyName getWrapperName() { return _wrapperName; }\n        @Override public boolean isRequired() { return _metadata.isRequired(); }\n        @Override public PropertyMetadata getMetadata() { return _metadata; }\n        @Override public AnnotatedMember getMember() { return _member; }\n\n        @Override\n        public boolean isVirtual() { return false; }\n\n        /**\n         * Implementation of this method throws\n         * {@link UnsupportedOperationException}, since instances of this\n         * implementation should not be used as part of actual structure\n         * visited. Rather, other implementations should handle it.\n         */\n        @Override\n        public void depositSchemaProperty(JsonObjectFormatVisitor objectVisitor,\n                SerializationContext ctxt) {\n            throw new UnsupportedOperationException(\"Instances of \"+getClass().getName()+\" should not get visited\");\n        }\n    }\n\n    /**\n     * Alternative \"Null\" implementation that can be used in cases where a non-null\n     * {@link BeanProperty} is needed\n     */\n    public static class Bogus implements BeanProperty\n    {\n        @Override\n        public String getName() {\n            return \"\";\n        }\n\n        @Override\n        public PropertyName getFullName() {\n            return PropertyName.NO_NAME;\n        }","sourceCodeStart":261,"sourceCodeEnd":297,"githubUrl":"https://github.com/FasterXML/jackson-databind/blob/87876ca5c0569b4933aec2d30d6225e4b9ba3a43/src/main/java/tools/jackson/databind/BeanProperty.java#L261-L297","documentation":"Thrown by BeanProperty.Std.depositSchemaProperty() (an internal placeholder BeanProperty implementation) when it is inadvertently visited during JSON schema generation. The Std implementation is a minimal stand-in meant only to carry property metadata for contextual deserializer/serializer lookup; it intentionally cannot emit schema properties. If schema generation reaches this object, it indicates an internal wiring path that was never expected to execute.","triggerScenarios":"Calling ObjectMapper.acceptJsonFormatVisitor() or generating a JSON Schema on a type whose serializer/property writer contains a BeanProperty.Std instance. This typically happens when a custom ValueSerializer or ValueDeserializerModifier constructs a BeanProperty.Std and registers it on a BeanPropertyWriter that then gets traversed by the format visitor.","commonSituations":"Custom serializers that reuse BeanProperty.Std as the property marker for properties that later get visited by schema generation. Also seen when third-party Jackson modules create writers without a real AnnotatedMember backing them.","solutions":["Override depositSchemaProperty() in your custom serializer/property writer to be a no-op or to delegate to a real property instead of using BeanProperty.Std.","Construct the BeanProperty with a concrete AnnotatedMember so the schema visitor has a real member to introspect.","Avoid passing BeanProperty.Std instances into BeanPropertyWriter constructors that participate in schema generation."],"exampleFix":"// before\nBeanProperty prop = new BeanProperty.Std(name, type, wrapperName, member);\n// after: provide a full implementation or skip schema visit\nBeanProperty prop = new BeanProperty.Std(name, type, wrapperName, member) {\n    @Override\n    public void depositSchemaProperty(JsonObjectFormatVisitor v, SerializationContext c) {\n        // no-op: this property does not contribute to schema\n    }\n};","handlingStrategy":"type-guard","validationCode":"// Before schema generation, check if the property is a placeholder\nif (property instanceof BeanProperty.Std) {\n    // skip or replace with a real property before visiting\n    return;\n}","typeGuard":"boolean isVisitableBeanProperty(BeanProperty p) {\n    return !(p instanceof BeanProperty.Std);\n}","tryCatchPattern":null,"preventionTips":["Do not register BeanProperty.Std instances on BeanPropertyWriters that participate in schema generation.","Override depositSchemaProperty in custom serializer property writers to no-op if the property is a placeholder.","Test schema generation (acceptJsonFormatVisitor) on every custom serializer to catch this early."],"tags":["schema-generation","bean-property","custom-serializer","internal-api"],"backgroundTag":null,"analyzedSha":"87876ca5c0569b4933aec2d30d6225e4b9ba3a43","analyzedAt":"2026-08-11T12:55:24.033Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}