{"record":{"id":"fad52eb60dd5a5a2","repo":"FasterXML/jackson-databind","slug":"property-getname-already-had-index-prop","errorCode":null,"errorMessage":"Property '${getName()}' already had index (${_propertyIndex}), trying to assign ${index}","messagePattern":"Property '(.+?)' already had index \\((.+?)\\), trying to assign (.+?)","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"src/main/java/tools/jackson/databind/deser/SettableBeanProperty.java","lineNumber":335,"sourceCode":"    public void setObjectIdInfo(ObjectIdInfo objectIdInfo) {\n        _objectIdInfo = objectIdInfo;\n    }\n\n    public void setViews(Class<?>[] views) {\n        if (views == null) {\n            _viewMatcher = null;\n        } else {\n            _viewMatcher = ViewMatcher.construct(views);\n        }\n    }\n\n    /**\n     * Method used to assign index for property.\n     */\n    public void assignIndex(int index) {\n        if (_propertyIndex != -1) {\n            if (_propertyIndex != index) {\n                throw new IllegalStateException(\"Property '\"+getName()+\"' already had index (\"+_propertyIndex+\"), trying to assign \"+index);\n            }\n        }\n        _propertyIndex = index;\n    }\n\n    /**\n     * Method called to ensure that the mutator has proper access rights to\n     * be called, as per configuration. Overridden by implementations that\n     * have mutators that require access, fields and setters.\n     */\n    public void fixAccess(DeserializationConfig config) {\n        ;\n    }\n\n    public void markAsIgnorable() { }\n\n    public boolean isIgnorable() { return false; }\n","sourceCodeStart":317,"sourceCodeEnd":353,"githubUrl":"https://github.com/FasterXML/jackson-databind/blob/87876ca5c0569b4933aec2d30d6225e4b9ba3a43/src/main/java/tools/jackson/databind/deser/SettableBeanProperty.java#L317-L353","documentation":"SettableBeanProperty.assignIndex tracks each property's position in the bean's property array; the same property is being assigned two different indices. The method tolerates reassigning the same index, but two distinct indices indicate the same logical property was registered twice with conflicting positions.","triggerScenarios":"Two different SettableBeanProperty instances sharing a name being indexed by BeanPropertyMap construction; a custom BeanDeserializerFactory that mutates indices inconsistently; mixins or rename operations that duplicate a property into the same map.","commonSituations":"Internal Jackson integrity violation usually surfaced by conflicting @JsonProperty aliases or duplicate property names after mixin application; custom deserializer modules that re-add properties; rarely hit by end users — typically indicates a bug in introspection or a custom factory.","solutions":["Eliminate duplicate property names in the target type (check @JsonProperty, getters/setters/fields that collapse to one name).","If using mixins, ensure they do not re-introduce a property already present on the target class.","If you maintain a custom BeanDeserializerFactory/Builder, ensure assignIndex is called once per distinct property instance.","Report a bug with a reproducer if this occurs with vanilla POJOs and no custom factories."],"exampleFix":"// before (conflicting aliases)\nclass Foo {\n    @JsonProperty(\"name\") String a;\n    @JsonProperty(\"name\") String b; // duplicate logical name\n}\n\n// after (distinct names or remove the duplicate)\nclass Foo {\n    String a;\n    String b;\n}","handlingStrategy":"validation","validationCode":"if (prop.getIndex() != -1 && prop.getIndex() != newIndex) {\n    throw new IllegalStateException(\"Refusing conflicting index on \" + prop.getName());\n}","typeGuard":"// internal invariant; no user-facing type guard","tryCatchPattern":"try { buildDeserializer(type); }\ncatch (IllegalStateException e) {\n    if (e.getMessage().contains(\"already had index\")) {\n        // look for duplicate @JsonProperty names on the type\n    } else throw e;\n}","preventionTips":["Avoid duplicate logical property names (collapsing getters/setters/fields to the same name twice).","If subclassing BeanDeserializerFactory, call assignIndex exactly once per property."],"tags":["deserialization","bean-property","internal","duplicate-property"],"backgroundTag":null,"analyzedSha":"87876ca5c0569b4933aec2d30d6225e4b9ba3a43","analyzedAt":"2026-08-11T12:55:24.033Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}