#1150·h3

`gridPathCells` can fail

Author: charleskawczynskiCreated Apr 6, 2026Updated Sep 14, 2026

From H3.jl (which simply calls the C binding):

import H3
p0 = (;latitude=41.141416500334635, longitude=-85.62262147756336)
p1 = (;latitude=36.678141479650726, longitude=-105.4336830442914)
cell(p, res) =
	H3.API.latLngToCell(H3.API.LatLng(deg2rad(p.latitude), deg2rad(p.longitude)), res)
c0 = cell(p0, 3)
c1 = cell(p1, 3)
@show H3.API.gridPathCellsSize(c0, c1) # returns error code object
@show H3.API.gridPathCells(c0, c1) # errors

yields

julia> import H3

julia> p0 = (;latitude=41.141416500334635, longitude=-85.62262147756336)
(latitude = 41.141416500334635, longitude = -85.62262147756336)

julia> p1 = (;latitude=36.678141479650726, longitude=-105.4336830442914)
(latitude = 36.678141479650726, longitude = -105.4336830442914)

julia> cell(p, res) =
               H3.API.latLngToCell(H3.API.LatLng(deg2rad(p.latitude), deg2rad(p.longitude)), res)
cell (generic function with 1 method)

julia> c0 = cell(p0, 3)
0x0832a96fffffffff

julia> c1 = cell(p1, 3)
0x08348dbfffffffff

julia> @show H3.API.gridPathCellsSize(c0, c1) # returns error code object

H3.API.gridPathCellsSize(c0, c1) = H3.API.H3ErrorCode(0x00000001)
H3ErrorCode(E_FAILED): The operation failed but a more specific error is not available

julia> @show H3.API.gridPathCells(c0, c1) # errors
ERROR: MethodError: no method matching Vector{UInt64}(::UndefInitializer, ::H3.API.H3ErrorCode)
The type `Vector{UInt64}` exists, but no method is defined for this combination of argument types when trying to construct it.

Closest candidates are:
  Array{T, N}(::Missing, ::Any...) where {T, N}
   @ Base baseext.jl:43
  Vector{T}(::UndefInitializer, ::Tuple{Int64}) where T
   @ Core boot.jl:591
  Vector{T}(::UndefInitializer, ::Int64) where T
   @ Core boot.jl:577
  ...

Stacktrace:
 [1] gridPathCells(origin::UInt64, destination::UInt64)
   @ H3.API ~/.julia/packages/H3/U8xMC/src/API.jl:384
 [2] macro expansion
   @ show.jl:1232 [inlined]
 [3] top-level scope
   @ REPL[8]:1

which shows that we're getting H3ErrorCode.