# Request for: examples of unhelpful selection of \`Closest candidates\` on a \`MethodError\`

**URL:** <https://discourse.julialang.org/t/request-for-examples-of-unhelpful-selection-of-closest-candidates-on-a-methoderror/138160>\
**Category:** General Usage\
**Tags:** error-message\
**Created:** [July 13, 2026, 1:36pm UTC](https://discourse.julialang.org/t/request-for-examples-of-unhelpful-selection-of-closest-candidates-on-a-methoderror/138160 "2026-07-13T13:36:07Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![adienes](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/adienes/32/37459_2.png) [@adienes](https://discourse.julialang.org/u/adienes)\
**Post date:** [July 13, 2026, 1:36pm UTC](https://discourse.julialang.org/t/request-for-examples-of-unhelpful-selection-of-closest-candidates-on-a-methoderror/138160/1 "2026-07-13T13:36:07Z")

</div>

I’m experimenting with the shortlisting algorithm used to select the list of suggested methods when a `MethodError` is hit. As I’m sure many of us have experienced, sometimes the suggested methods are in fact not at all related to the “true” most relevant.

I would love any kind of examples along these lines of a time that you encountered a `MethodError` but the closest candidates list was, in your subjective opinion, poorly selected! Any kind of packages, contexts, complexity, etc. are welcome. If possible, ideally make the MWE something I can reproduce myself 🙂

---

<div class="post-metadata">

**Author:** ![mbauman](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mbauman/32/31082_2.png) [@mbauman](https://discourse.julialang.org/u/mbauman)\
**Post date:** [July 13, 2026, 1:51pm UTC](https://discourse.julialang.org/t/request-for-examples-of-unhelpful-selection-of-closest-candidates-on-a-methoderror/138160/2 "2026-07-13T13:51:26Z")

</div>

I’m most frequently annoyed by it in cases where it’s just not a supported operation in the first place. Things like:

```julia-repl
julia> Int(Day(1))
ERROR: MethodError: no method matching Int64(::Day)
The type `Int64` exists, but no method is defined for this combination of argument types when trying to construct it.

Closest candidates are:
  Int64(::Float64)
   @ Base float.jl:990
  Int64(::Float32)
   @ Base float.jl:990
  Int64(::Float16)
   @ Base float.jl:990
  ...

Stacktrace:
 [1] top-level scope
   @ REPL[6]:1

julia> convert(Int, Day(1))
ERROR: MethodError: Cannot `convert` an object of type Day to an object of type Int64
The function `convert` exists, but no method is defined for this combination of argument types.

Closest candidates are:
  convert(::Type{T}, ::T) where T<:Number
   @ Base number.jl:6
  convert(::Type{T}, ::T) where T
   @ Base Base.jl:126
  convert(::Type{T}, ::Number) where T<:Number
   @ Base number.jl:7
  ...

Stacktrace:
 [1] top-level scope
   @ REPL[7]:1

```

Maybe that’s a different class than you’re after, though.
