# HTTP returns an error in Julia 1.11.1

**URL:** <https://discourse.julialang.org/t/http-returns-an-error-in-julia-1-11-1/122312>\
**Category:** Web Stack\
**Tags:** package, http\
**Created:** [November 6, 2024, 12:48am UTC](https://discourse.julialang.org/t/http-returns-an-error-in-julia-1-11-1/122312 "2024-11-06T00:48:10Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![wshobe](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/wshobe/32/213209_2.png) [@wshobe](https://discourse.julialang.org/u/wshobe)\
**Post date:** [November 6, 2024, 12:48am UTC](https://discourse.julialang.org/t/http-returns-an-error-in-julia-1-11-1/122312/1 "2024-11-06T00:48:10Z")

</div>

I have just updated to Julia 1.11.1 and HTTP is now returning an error, where it worked before the update. Any thoughts would be appreciated.

The call is very simple:

```using
resp = HTTP.request("GET", "http://httpbin.org/ip")

```

This code returns the following:

```julia
	"name": "MethodError",
	"message": "MethodError: Cannot `convert` an object of type 
  SubArray{UInt8,1,Memory{UInt8},Tuple{UnitRange{Int64}},true} to an object of type 
  SubArray{UInt8,1,Vector{UInt8},Tuple{UnitRange{Int64}},true}
The function `convert` exists, but no method is defined for this combination of argument types.

Closest candidates are:
  SubArray{T, N, P, I, L}(::Any, !Matched::Any, !Matched::Any, !Matched::Any) where {T, N, P, I, L}
   @ Base subarray.jl:19
  convert(::Type{T}, !Matched::T) where T
   @ Base Base.jl:126
  convert(::Type{T}, !Matched::LinearAlgebra.Factorization) where T<:AbstractArray
   @ LinearAlgebra /Applications/Julia-1.11.app/Contents/Resources/julia/share/julia/stdlib/v1.11/LinearAlgebra/src/factorization.jl:104
  ...
",
	"stack": "MethodError: Cannot `convert` an object of type 
  SubArray{UInt8,1,Memory{UInt8},Tuple{UnitRange{Int64}},true} to an object of type 
  SubArray{UInt8,1,Vector{UInt8},Tuple{UnitRange{Int64}},true}
The function `convert` exists, but no method is defined for this combination of argument types.

Closest candidates are:
  SubArray{T, N, P, I, L}(::Any, !Matched::Any, !Matched::Any, !Matched::Any) where {T, N, P, I, L}
   @ Base subarray.jl:19
  convert(::Type{T}, !Matched::T) where T
   @ Base Base.jl:126
  convert(::Type{T}, !Matched::LinearAlgebra.Factorization) where T<:AbstractArray
   @ LinearAlgebra /Applications/Julia-1.11.app/Contents/Resources/julia/share/julia/stdlib/v1.11/LinearAlgebra/src/factorization.jl:104
  ...

Stacktrace:
  [1] readuntil(buf::IOBuffer, find_delimiter::typeof(HTTP.Parsers.find_end_of_header))
    @ HTTP.IOExtras ~/.julia/packages/HTTP/aTjcj/src/IOExtras.jl:139
  [2] readuntil(t::HTTP.ConnectionPool.Transaction{MbedTLS.SSLContext}, f::Function, sizehint::Int64)
    @ HTTP.ConnectionPool ~/.julia/packages/HTTP/aTjcj/src/ConnectionPool.jl:296
  [3] readuntil(t::HTTP.ConnectionPool.Transaction{MbedTLS.SSLContext}, f::Function)
    @ HTTP.ConnectionPool ~/.julia/packages/HTTP/aTjcj/src/ConnectionPool.jl:292
  [4] readheaders(io::HTTP.ConnectionPool.Transaction{MbedTLS.SSLContext}, message::HTTP.Messages.Response)
    @ HTTP.Messages ~/.julia/packages/HTTP/aTjcj/src/Messages.jl:537
  [5] startread(http::HTTP.Streams.Stream{HTTP.Messages.Response, HTTP.ConnectionPool.Transaction{MbedTLS.SSLContext}})
    @ HTTP.Streams ~/.julia/packages/HTTP/aTjcj/src/Streams.jl:170
  [6] macro expansion
    @ ~/.julia/packages/HTTP/aTjcj/src/StreamRequest.jl:67 [inlined]
  [7] macro expansion
    @ ./task.jl:498 [inlined]
  [8] request(::Type{StreamLayer{Union{}}}, io::HTTP.ConnectionPool.Transaction{MbedTLS.SSLContext}, req::HTTP.Messages.Request, body::Vector{UInt8}; reached_redirect_limit::Bool, response_stream::Nothing, iofunction::Nothing, verbose::Int64, kw::@Kwargs{})
    @ HTTP.StreamRequest ~/.julia/packages/HTTP/aTjcj/src/StreamRequest.jl:57
  [9] request(::Type{ConnectionPoolLayer{StreamLayer{Union{}}}}, url::URIs.URI, req::HTTP.Messages.Request, body::Vector{UInt8}; proxy::Nothing, socket_type::Type, reuse_limit::Int64, kw::@Kwargs{iofunction::Nothing, reached_redirect_limit::Bool})
    @ HTTP.ConnectionRequest ~/.julia/packages/HTTP/aTjcj/src/ConnectionRequest.jl:108
 [10] request(::Type{ExceptionLayer{ConnectionPoolLayer{StreamLayer{Union{}}}}}, ::URIs.URI, ::Vararg{Any}; kw::@Kwargs{iofunction::Nothing, reached_redirect_limit::Bool})
    @ HTTP.ExceptionRequest ~/.julia/packages/HTTP/aTjcj/src/ExceptionRequest.jl:19
 [11] (::Base.var\"#106#108\"{Base.var\"#106#107#109\"{ExponentialBackOff, HTTP.RetryRequest.var\"#2#3\"{Bool, HTTP.Messages.Request}, typeof(HTTP.request)}})(::Type, ::Vararg{Any}; kwargs::@Kwargs{iofunction::Nothing, reached_redirect_limit::Bool})
    @ Base ./error.jl:300
 [12] request(::Type{RetryLayer{ExceptionLayer{ConnectionPoolLayer{StreamLayer{Union{}}}}}}, url::URIs.URI, req::HTTP.Messages.Request, body::Vector{UInt8}; retries::Int64, retry_non_idempotent::Bool, kw::@Kwargs{iofunction::Nothing, reached_redirect_limit::Bool})
    @ HTTP.RetryRequest ~/.julia/packages/HTTP/aTjcj/src/RetryRequest.jl:44
 [13] request(::Type{MessageLayer{RetryLayer{ExceptionLayer{ConnectionPoolLayer{StreamLayer{Union{}}}}}}}, method::String, url::URIs.URI, headers::Vector{Pair{SubString{String}, SubString{String}}}, body::Vector{UInt8}; http_version::VersionNumber, target::String, parent::Nothing, iofunction::Nothing, kw::@Kwargs{reached_redirect_limit::Bool})
    @ HTTP.MessageRequest ~/.julia/packages/HTTP/aTjcj/src/MessageRequest.jl:66
 [14] request(::Type{BasicAuthLayer{MessageLayer{RetryLayer{ExceptionLayer{ConnectionPoolLayer{StreamLayer{Union{}}}}}}}}, method::String, url::URIs.URI, headers::Vector{Pair{SubString{String}, SubString{String}}}, body::Vector{UInt8}; kw::@Kwargs{reached_redirect_limit::Bool})
    @ HTTP.BasicAuthRequest ~/.julia/packages/HTTP/aTjcj/src/BasicAuthRequest.jl:28
 [15] request(::Type{RedirectLayer{BasicAuthLayer{MessageLayer{RetryLayer{ExceptionLayer{ConnectionPoolLayer{StreamLayer{Union{}}}}}}}}}, method::String, url::URIs.URI, headers::Vector{Pair{SubString{String}, SubString{String}}}, body::Vector{UInt8}; redirect_limit::Int64, forwardheaders::Bool, kw::@Kwargs{})
    @ HTTP.RedirectRequest ~/.julia/packages/HTTP/aTjcj/src/RedirectRequest.jl:28
 [16] request(::Type{RedirectLayer{BasicAuthLayer{MessageLayer{RetryLayer{ExceptionLayer{ConnectionPoolLayer{StreamLayer{Union{}}}}}}}}}, method::String, url::URIs.URI, headers::Vector{Pair{SubString{String}, SubString{String}}}, body::Vector{UInt8})
    @ HTTP.RedirectRequest ~/.julia/packages/HTTP/aTjcj/src/RedirectRequest.jl:18
 [17] request(::Type{TopLayer{RedirectLayer{BasicAuthLayer{MessageLayer{RetryLayer{ExceptionLayer{ConnectionPoolLayer{StreamLayer{Union{}}}}}}}}}}, ::String, ::Vararg{Any}; kwargs::@Kwargs{})
    @ HTTP.TopRequest ~/.julia/packages/HTTP/aTjcj/src/TopRequest.jl:15
 [18] request(::Type{TopLayer{RedirectLayer{BasicAuthLayer{MessageLayer{RetryLayer{ExceptionLayer{ConnectionPoolLayer{StreamLayer{Union{}}}}}}}}}}, ::String, ::URIs.URI, ::Vector{Pair{SubString{String}, SubString{String}}}, ::Vector{UInt8})
    @ HTTP.TopRequest ~/.julia/packages/HTTP/aTjcj/src/TopRequest.jl:15
 [19] request(method::String, url::String, h::Vector{Pair{SubString{String}, SubString{String}}}, b::Vector{UInt8}; headers::Vector{Pair{SubString{String}, SubString{String}}}, body::Vector{UInt8}, query::Nothing, kw::@Kwargs{})
    @ HTTP ~/.julia/packages/HTTP/aTjcj/src/HTTP.jl:330
 [20] request (repeats 2 times)
    @ ~/.julia/packages/HTTP/aTjcj/src/HTTP.jl:328 [inlined]
 [21] get(a::String)
    @ HTTP ~/.julia/packages/HTTP/aTjcj/src/HTTP.jl:407
 [22] top-level scope
    @ ~/Programming/Julia/energy/jl_notebook_cell_df34fa98e69747e1a8f8a730347b8e2f_W2sZmlsZQ==.jl:3"
}

```

---

<div class="post-metadata">

**Author:** ![giordano](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/giordano/32/2166_2.png) [@giordano](https://discourse.julialang.org/u/giordano)\
**Post date:** [November 6, 2024, 2:15am UTC](https://discourse.julialang.org/t/http-returns-an-error-in-julia-1-11-1/122312/2 "2024-11-06T02:15:47Z")

</div>

Seems to work fine for me:

```julia
julia> using HTTP

julia> resp = HTTP.request("GET", "http://httpbin.org/ip")
HTTP.Messages.Response:
"""
HTTP/1.1 200 OK
Date: Wed, 06 Nov 2024 02:15:01 GMT
Content-Type: application/json
Content-Length: 31
Connection: keep-alive
Server: gunicorn/19.9.0
Access-Control-Allow-Origin: *
Access-Control-Allow-Credentials: true

{
  "origin": "90.219.96.84"
}
"""

julia> versioninfo()
Julia Version 1.11.1
Commit 8f5b7ca12ad (2024-10-16 10:53 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: macOS (arm64-apple-darwin22.4.0)
  CPU: 8 × Apple M1
  WORD_SIZE: 64
  LLVM: libLLVM-16.0.6 (ORCJIT, apple-m1)
Threads: 1 default, 0 interactive, 1 GC (on 4 virtual cores)

(jl_wdo6uY) pkg> st
Status `/private/var/folders/v2/hmy3kzgj4tb3xsy8qkltxd0r0000gn/T/jl_wdo6uY/Project.toml`
  [cd3eb016] HTTP v1.10.9

```

---

<div class="post-metadata">

**Author:** ![wshobe](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/wshobe/32/213209_2.png) [@wshobe](https://discourse.julialang.org/u/wshobe)\
**Post date:** [November 6, 2024, 12:21pm UTC](https://discourse.julialang.org/t/http-returns-an-error-in-julia-1-11-1/122312/3 "2024-11-06T12:21:05Z")

</div>

As it turns out, I had an old version of the HTTP package installed. It could not be updated due to the presence of the Temporal package. I removed Temporal, updated HTTP. Now everything is working.

---

<div class="post-metadata">

**Author:** ![Ashita](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ashita/32/213471_2.png) [@Ashita](https://discourse.julialang.org/u/Ashita)\
**Post date:** [November 17, 2024, 3:41am UTC](https://discourse.julialang.org/t/http-returns-an-error-in-julia-1-11-1/122312/4 "2024-11-17T03:41:40Z")

</div>

Hi, This is a very recent issue seeming to be related to the new Julia Version 1.11.

My previous code using HTTP worked fine, but now gives the same error as incurred above:

```julia
julia> show(err)
1-element ExceptionStack:
LoadError: MethodError: Cannot `convert` an object of type
  SubArray{UInt8,1,Memory{UInt8},Tuple{UnitRange{Int64}},true} to an object of type
  SubArray{UInt8,1,Vector{UInt8},Tuple{UnitRange{Int64}},true}
The function `convert` exists, but no method is defined for this combination of argument types.

```

It seems to be some incompatibility with the HTTP package and the new Julia version.

---

<div class="post-metadata">

**Author:** ![Ashita](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ashita/32/213471_2.png) [@Ashita](https://discourse.julialang.org/u/Ashita)\
**Post date:** [November 17, 2024, 3:45am UTC](https://discourse.julialang.org/t/http-returns-an-error-in-julia-1-11-1/122312/5 "2024-11-17T03:45:09Z")

</div>

If anyone can help me please. I have updated my HTTP to v1.10.10 but even the following does not work for me.

```julia
resp = HTTP.get("http://httpbin.org/ip") #error is: Method Error: Cannot 'convert' and object of type

```

Yet if i run the url call in a browser it works fine. Appreciate your support!

---

<div class="post-metadata">

**Author:** ![jling](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jling/32/212909_2.png) [@jling](https://discourse.julialang.org/u/jling)\
**Post date:** [November 17, 2024, 5:24am UTC](https://discourse.julialang.org/t/http-returns-an-error-in-julia-1-11-1/122312/6 "2024-11-17T05:24:33Z")

</div>

> [@Ashita](#):
>
> `HTTP.get("http://httpbin.org/ip")`

```julia
julia> using HTTP

julia> HTTP.get("http://httpbin.org/ip")
HTTP.Messages.Response:
"""
HTTP/1.1 200 OK
Date: Sun, 17 Nov 2024 05:24:17 GMT
Content-Type: application/json
Content-Length: 30
Connection: keep-alive
Server: gunicorn/19.9.0
Access-Control-Allow-Origin: *
Access-Control-Allow-Credentials: true

"""

(jl_UvIZN2) pkg> st
Status `/tmp/jl_UvIZN2/Project.toml`
  [cd3eb016] HTTP v1.10.10

```

can you post the `]st` output?

---

<div class="post-metadata">

**Author:** ![Ashita](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ashita/32/213471_2.png) [@Ashita](https://discourse.julialang.org/u/Ashita)\
**Post date:** [November 17, 2024, 12:00pm UTC](https://discourse.julialang.org/t/http-returns-an-error-in-julia-1-11-1/122312/7 "2024-11-17T12:00:54Z")

</div>

Hi Jling, Appreciate the support.  
I’ve managed to figure out a few things.  
I have two computers: 1) Toshiba, 2) Dell.

Yesterday i loaded up JuliaInXL v1.2.0 (on the Dell) and had been experimenting with this. This morning I went back to my code that uses the HTTP (on the Dell) and this is when the trouble started.

This afternoon (after a lot of pondering) i went back to the Toshiba (which did not have the JuliaInXL installed) and all the code worked fine!

The following is my Toshiba ]status :  
(@v1.11) pkg\> st  
Status `C:\Users\A\.julia\environments\v1.11\Project.toml`  
[a93c6f00] DataFrames v1.7.0  
[cd3eb016] HTTP v1.10.10  
[682c06a0] JSON v0.21.4  
[9e3dc215] TimeSeries v0.24.2  
[fdbf4ff8] XLSX v0.10.4  
[ade2ca70] Dates v1.11.0

which delivers the following successfully:

```julia
julia> resp = HTTP.get("http://httpbin.org/ip")
HTTP.Messages.Response:
"""
HTTP/1.1 200 OK
Date: Sun, 17 Nov 2024 11:33:07 GMT
Content-Type: application/json
Content-Length: 30
Connection: keep-alive
Server: gunicorn/19.9.0
Access-Control-Allow-Origin: *
Access-Control-Allow-Credentials: true

```

So then i started cleaning up the Dell packages. After cleaning out a lot of the packages, below is my Dell ]status :

```julia
(@v1.11) pkg> st
Status `C:\Users\A\.julia\environments\v1.11\Project.toml`
  [9600883c] JuliaInXL v1.2.0

(@v1.11) pkg> add HTTP
   Resolving package versions...
    Updating `C:\Users\P\.julia\environments\v1.11\Project.toml`
⌅ [cd3eb016] + HTTP v0.9.17
  No Changes to `C:\Users\P\.julia\environments\v1.11\Manifest.toml`

```

I then ran the same HTTP call and it gives the following error:

```julia
ERROR: MethodError: Cannot `convert` an object of type 
  SubArray{UInt8,1,Memory{UInt8},Tuple{UnitRange{Int64}},true} to an object of type 
  SubArray{UInt8,1,Vector{UInt8},Tuple{UnitRange{Int64}},true}
The function `convert` exists, but no method is defined for this combination of argument types.

```

So i think it’s version compatibility with JuliaInXL, however when i run:

```julia
] 
rm JuliaInXL then upgrade the HTTP to v1.10.10
like so,
(@v1.11) pkg> status
Status `C:\Users\P\.julia\environments\v1.11\Project.toml`
  [cd3eb016] HTTP v1.10.10

```

When i go back and run the HTTP code, it still won’t work on the Dell.

Any thoughts on how to restore functionality to the HTTP package? Appreciate your support!

---

<div class="post-metadata">

**Author:** ![jling](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jling/32/212909_2.png) [@jling](https://discourse.julialang.org/u/jling)\
**Post date:** [November 17, 2024, 6:20pm UTC](https://discourse.julialang.org/t/http-returns-an-error-in-julia-1-11-1/122312/8 "2024-11-17T18:20:55Z")

</div>

> [@Ashita](#):
>
> ` [9600883c] JuliaInXL v1.2.0`

you just gotta remove that I guess

---

<div class="post-metadata">

**Author:** ![Ashita](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ashita/32/213471_2.png) [@Ashita](https://discourse.julialang.org/u/Ashita)\
**Post date:** [November 18, 2024, 6:44am UTC](https://discourse.julialang.org/t/http-returns-an-error-in-julia-1-11-1/122312/9 "2024-11-18T06:44:47Z")

</div>

Yes, i removed it, but there is still some conflict. Even despite the HTTPv1.10.10 now.

Maybe i have to delete a folder or files somewhere? Appreciate your insight.

---

<div class="post-metadata">

**Author:** ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Post date:** [November 18, 2024, 8:27am UTC](https://discourse.julialang.org/t/http-returns-an-error-in-julia-1-11-1/122312/10 "2024-11-18T08:27:18Z")

</div>

Always a good idea to use a separate `Project.toml` file per project. E.g.:

```bash
mkdir myproject
cd myproject
julia --project="."

```

And then in Julia:

```julia
]
add HTTP
add ... # all the other packages you need

```

And if you add your additional packages one by one you would also see if one of the additional packages causes HTTP to be downgraded.

See also: [Working with Julia projects | Julia programming notes](https://ufechner7.github.io/2022/08/16/julia-projects.html)

---

<div class="post-metadata">

**Author:** ![Ashita](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ashita/32/213471_2.png) [@Ashita](https://discourse.julialang.org/u/Ashita)\
**Post date:** [November 19, 2024, 12:42am UTC](https://discourse.julialang.org/t/http-returns-an-error-in-julia-1-11-1/122312/11 "2024-11-19T00:42:26Z")

</div>

thanks Jling, ufechner7… appreciate the help. Should be good from here…

---

<div class="post-metadata">

**Author:** ![alasaadstat](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/alasaadstat/32/975_2.png) [@alasaadstat](https://discourse.julialang.org/u/alasaadstat)\
**Post date:** [October 1, 2025, 4:02am UTC](https://discourse.julialang.org/t/http-returns-an-error-in-julia-1-11-1/122312/12 "2025-10-01T04:02:07Z")

</div>

I ran into the same issue, and I got it to work by deleting the cache of compiled packages:

```julia-auto
rm -rf ~/.julia/compiled

```

It worked after this.
