question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

InvalidTypeIdException Cannot deduce unique subtype

See original GitHub issue

I am attempting to use deduction with 2.13.3

I have a set of classes that have a largish set of properties (over 10) and sometimes only differ by one or two fields

Some of the classes are able to deserialize correctly but others get this exception

com.fasterxml.jackson.databind.exc.InvalidTypeIdException: Could not resolve subtype of [simple type, class xxxxx]: Cannot deduce unique subtype of oxxxxxxx (3 candidates match)

If I step debug the code I can see this before the error is thrown. It appears there is something called subTypeFingerprints that shows this

Screen Shot 2022-08-19 at 7 12 52 PM

What is interesting is that the error says 3 candidates match and as you can see from the picture above… there are 3 candidates that match up to the value of 11…

is there a limit on the number of comparisons that are made? As you can see the fingerprints seem to indicate that a deduction should be possible, yet I am getting this error

-john

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
jmjavacommented, Aug 21, 2022

@cowtowncoder THANK YOU VERY MUCH!!! I will give this a try.

-john

0reactions
cowtowncodercommented, Aug 21, 2022

(sounds like use of As.EXTERNAL_PROPERTY was what was needed – closing. There is also an existing issue wrt Deduction not taking into account absence of property.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot deduce unique subtype (multiple candidates)
InvalidTypeIdException : Could not resolve subtype of [simple type, class testproject.demo.BaseModel]: Cannot deduce unique subtype of `testproject.demo.
Read more >
Jackson Polymorphic deserialziation into a specific subtype ...
InvalidTypeIdException : Missing type id when trying to resolve subtype of [simple type, class com.foo.bar.SerializationTest$Foo]: missing ...
Read more >
Polymorphic subtype deduction based on 'presence ... - GitHub
InvalidTypeIdException : Cannot deduce unique subtype of com.engageft.services.carta.integrations.domain.response.serviceresponse.
Read more >
Deduction-Based Polymorphism in Jackson 2.12 - Baeldung
Firstly, if we try to read the above JSON structure, Jackson would throw a runtime exception with the message Could not resolve subtype...
Read more >
com.fasterxml.jackson.databind.jsontype.impl ...
InvalidTypeIdException ; import com.fasterxml.jackson.databind.introspect. ... new InvalidTypeIdException(p, String.format("Cannot deduce unique subtype of ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found