bauglir/Kroki.jl

Kroki fails to display in VS Code and Pluto notebooks

neelsmith opened this issue · 2 comments

Using Julia 1.8.5, I'm hitting the following error when I use Kroki in VS Code, Pluto or REPL:

Display Error: ERROR: MethodError: transcode(::Type{CodecZlib.ZlibCompressor}, ::String) is ambiguous. Candidates:
  transcode(T, src::String) in Base at c.jl:306
  transcode(::Type{C}, args...) where C<:TranscodingStreams.Codec in TranscodingStreams at /Users/nsmith/.julia/packages/TranscodingStreams/5yQuA/src/transcode.jl:33
Possible fix, define
  transcode(::Type{C}, ::String) where C<:TranscodingStreams.Codec
Stacktrace:
  [1] render(diagram::Diagram, output_format::String; options::Dict{String, String})
    @ Kroki ~/.julia/packages/Kroki/H8tYL/src/Kroki.jl:172
  [2] render
    @ ~/.julia/packages/Kroki/H8tYL/src/Kroki.jl:149 [inlined]
  [3] show(io::IOBuffer, #unused#::MIME{Symbol("image/svg+xml")}, diagram::Diagram)
    @ Kroki ~/.julia/packages/Kroki/H8tYL/src/Kroki.jl:351
  [4] __binrepr(m::MIME{Symbol("image/svg+xml")}, x::Diagram, context::Nothing)
    @ Base.Multimedia ./multimedia.jl:159
  [5] display(d::VSCodeServer.InlineDisplay, m::MIME{Symbol("image/svg+xml")}, x::Diagram)
    @ VSCodeServer ~/.vscode/extensions/julialang.language-julia-1.38.2/scripts/packages/VSCodeServer/src/display.jl:0
  [6] display(d::VSCodeServer.InlineDisplay, mime::String, x::Any)
    @ Base.Multimedia ./multimedia.jl:216
  [7] display(d::VSCodeServer.InlineDisplay, x::Diagram)
    @ VSCodeServer ~/.vscode/extensions/julialang.language-julia-1.38.2/scripts/packages/VSCodeServer/src/display.jl:165
  [8] #invokelatest#2
    @ ./essentials.jl:729 [inlined]
  [9] invokelatest
    @ ./essentials.jl:726 [inlined]
 [10] (::VSCodeServer.var"#66#70"{Bool, Bool, Bool, Module, String, Int64, Int64, String, VSCodeServer.ReplRunCodeRequestParams})()
    @ VSCodeServer ~/.vscode/extensions/julialang.language-julia-1.38.2/scripts/packages/VSCodeServer/src/eval.jl:207
 [11] withpath(f::VSCodeServer.var"#66#70"{Bool, Bool, Bool, Module, String, Int64, Int64, String, VSCodeServer.ReplRunCodeRequestParams}, path::String)
    @ VSCodeServer ~/.vscode/extensions/julialang.language-julia-1.38.2/scripts/packages/VSCodeServer/src/repl.jl:249
 [12] (::VSCodeServer.var"#65#69"{Bool, Bool, Bool, Module, String, Int64, Int64, String, VSCodeServer.ReplRunCodeRequestParams})()
    @ VSCodeServer ~/.vscode/extensions/julialang.language-julia-1.38.2/scripts/packages/VSCodeServer/src/eval.jl:155
 [13] hideprompt(f::VSCodeServer.var"#65#69"{Bool, Bool, Bool, Module, String, Int64, Int64, String, VSCodeServer.ReplRunCodeRequestParams})
    @ VSCodeServer ~/.vscode/extensions/julialang.language-julia-1.38.2/scripts/packages/VSCodeServer/src/repl.jl:38
 [14] (::VSCodeServer.var"#64#68"{Bool, Bool, Bool, Module, String, Int64, Int64, String, VSCodeServer.ReplRunCodeRequestParams})()
    @ VSCodeServer ~/.vscode/extensions/julialang.language-julia-1.38.2/scripts/packages/VSCodeServer/src/eval.jl:126
 [15] with_logstate(f::Function, logstate::Any)
    @ Base.CoreLogging ./logging.jl:511
 [16] with_logger
    @ ./logging.jl:623 [inlined]
 [17] (::VSCodeServer.var"#63#67"{VSCodeServer.ReplRunCodeRequestParams})()
    @ VSCodeServer ~/.vscode/extensions/julialang.language-julia-1.38.2/scripts/packages/VSCodeServer/src/eval.jl:225
 [18] #invokelatest#2
    @ ./essentials.jl:729 [inlined]
 [19] invokelatest(::Any)
    @ Base ./essentials.jl:726
 [20] macro expansion
    @ ~/.vscode/extensions/julialang.language-julia-1.38.2/scripts/packages/VSCodeServer/src/eval.jl:34 [inlined]
 [21] (::VSCodeServer.var"#61#62")()
    @ VSCodeServer ./task.jl:484

Thanks for reporting! This is a duplicate of #41 and not an issue in Kroki but in TranscodingStreams (JuliaIO/TranscodingStreams.jl#139) as far as I'm concerned (which broke it's documented API). I have filed a PR (JuliaIO/TranscodingStreams.jl#141) to resolve the issue a couple of days ago, but it hasn't been merged/released yet.

To work around it for the time being, pinning TranscodingStreams to v0.9.11 should work around the issue.

Sorry -- missed the already closed #41!

And thanks for the work around: for the time being, that's the most valuable info I could get!