The trace ends inside a library you did not write. The instinct is that you have found a bug in the library, and the overwhelming probability is that you passed it something it did not expect.
What is the first move?
Find the last line in the trace that refers to your own code. That is where you called into the library, and the values you passed at that point are the thing to examine.
The library is telling you it received something it could not work with, and the question is where that came from.
Why is it usually your input?
Because established libraries are used by very large numbers of people, and the common paths are well exercised. A bug reaching you would have to be in a case nobody else hits, which is possible and unlikely.
What should you check?
- The types you passed. Not what you intended to pass.
- Empty or absent values. Which are the usual culprit.
- The version. Against the documentation you are following.
- The order of calls. Some libraries require setup first.
What is the version trap?
Following documentation or generated code written for a different version. A method that was renamed, a parameter that changed meaning, or a default that flipped all produce errors inside the library that look like bugs.
Checking your installed version against the documentation you are reading is a thirty-second check that resolves a lot of this.
Should you read the library source?
Frequently yes, and people are reluctant to. The code is on your machine, the failing line is named in the trace, and reading the twenty lines around it usually explains exactly what condition was violated.
Here is the trace ending inside this library, and here is the code where I call it. What is the library expecting at this point, and what would I have passed to produce this?
How do you tell if it genuinely is a bug?
Reproduce it minimally, outside your application, with the smallest possible input. If a few lines using only the library reproduce it, you have something worth reporting; if it only happens inside your application, the cause is yours.
What do you do about a real one?
Search the issue tracker first, since somebody has usually reported it and the thread frequently contains a workaround. If not, report it with the minimal reproduction, which is the thing that makes a report actionable.
What about working around it?
Reasonable and worth documenting. A comment explaining why the code does something odd, with a link to the issue, prevents somebody removing the workaround later and reintroducing the problem.
What if the library is unmaintained?
A different problem worth recognising early. A project with no releases for several years, unanswered issues and no responsive maintainer will not be fixed, whatever the merits of your report.
The options are a workaround you document, a fork you maintain, or a replacement. All three are more work than a fix and the decision is worth making deliberately rather than after waiting three months for a response. Checking a dependency's activity before adopting it is what prevents arriving in this position.
What is the wrong response?
Modifying the library on your machine, which works until the next install and produces a failure nobody can explain. Pinning a version that works is the acceptable version of the same instinct.