# Looking for Emacs users to help me debug an issue with Emacs, eglot, and jetls

**URL:** <https://discourse.julialang.org/t/looking-for-emacs-users-to-help-me-debug-an-issue-with-emacs-eglot-and-jetls/136987>\
**Category:** Tooling\
**Tags:** question, emacs, jetls\
**Created:** [May 5, 2026, 1:15pm UTC](https://discourse.julialang.org/t/looking-for-emacs-users-to-help-me-debug-an-issue-with-emacs-eglot-and-jetls/136987 "2026-05-05T13:15:20Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [May 5, 2026, 1:15pm UTC](https://discourse.julialang.org/t/looking-for-emacs-users-to-help-me-debug-an-issue-with-emacs-eglot-and-jetls/136987/1 "2026-05-05T13:15:20Z")

</div>

I ran into [an issue](https://github.com/aviatesk/JETLS.jl/issues/651) with either Emacs, `eglot`, or `jetls`. @aviatesk was unable to reproduce it, so I made a minimal reproducible environment with straight.el at

> **[GitHub - tpapp/eglot-problem-mwe: MWE for...](https://github.com/tpapp/eglot-problem-mwe)**
>
> MWE for https://github.com/aviatesk/JETLS.jl/issues/651

I wonder if anyone can reproduce the issue running from `./run.sh`, and if `file.jl` is otherwise fine in your standard config, how the versions of the relevant packages differ.

I really want to use jetls but there may be an issue lurking in my setup that I need to track down to make the experience hassle-free.

---

<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:** [May 5, 2026, 1:43pm UTC](https://discourse.julialang.org/t/looking-for-emacs-users-to-help-me-debug-an-issue-with-emacs-eglot-and-jetls/136987/2 "2026-05-05T13:43:29Z")

</div>

I can reproduce it

 ![image](https://global.discourse-cdn.com/julialang/original/3X/d/6/d629d2a5b797fc15e526f890d815258760b2ac7c.png)

---

<div class="post-metadata">

**Author:** ![aviatesk](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/aviatesk/32/7610_2.png) [@aviatesk](https://discourse.julialang.org/u/aviatesk)\
**Post date:** [May 5, 2026, 2:54pm UTC](https://discourse.julialang.org/t/looking-for-emacs-users-to-help-me-debug-an-issue-with-emacs-eglot-and-jetls/136987/3 "2026-05-05T14:54:40Z")

</div>

Thanks for putting together the MWE.  
I dug into this and the eglot error message itself is a strong signal:

(args-out-of-range “inplace\_∂g∂x\_v!(x)” 21 22)

The string “inplace\_∂g∂x\_v!(x)” has:

- 18 characters
- 22 bytes in UTF-8 (each `∂` takes 3 bytes)
- 18 UTF-16 code units (∂ is in the BMP)

The args `21 22` only match the UTF-8 byte length. Emacs string indexing is character-based, so accessing index 21–22 in an 18-character string blows up. So eglot has a code path that’s receiving UTF-8 byte offsets but using them as Emacs character positions without converting. That a timer fires it suggests something in the eldoc / hover-related-info display.

What JETLS does: it checks `general.positionEncodings` from the client and prefers UTF-8 if advertised (since UTF-8 is the native encoding for Julia strings — no conversion needed server-side), falling back to UTF-16 otherwise. eglot 1.17+ advertises UTF-8, so JETLS picks UTF-8 when talking to it.  
VS Code and Zed both handle the same UTF-8 positions correctly, which is consistent with this being a bug somewhere in eglot’s processing path rather than in the data JETLS sends.

You can verify this on your setup by forcing JETLS to use UTF-16. [Set up a local JETLS checkout](https://aviatesk.github.io/JETLS.jl/release/#index/editor-setup/advanced) with this patch applied to JETLS:

```diff
diff --git a/src/initialize.jl b/src/initialize.jl
index 4ba882ae..022725cc 100644
--- a/src/initialize.jl
+++ b/src/initialize.jl
@@ -261,14 +261,15 @@ function handle_InitializeRequest(
         end
     end
 
- positionEncodings = getcapability(state, :general, :positionEncodings)
- if isnothing(positionEncodings) || isempty(positionEncodings)
- positionEncoding = PositionEncodingKind.UTF16
- elseif PositionEncodingKind.UTF8 in positionEncodings
- positionEncoding = PositionEncodingKind.UTF8
- else
- positionEncoding = first(positionEncodings)
- end
+ # positionEncodings = getcapability(state, :general, :positionEncodings)
+ # if isnothing(positionEncodings) || isempty(positionEncodings)
+ # positionEncoding = PositionEncodingKind.UTF16
+ # elseif PositionEncodingKind.UTF8 in positionEncodings
+ # positionEncoding = PositionEncodingKind.UTF8
+ # else
+ # positionEncoding = first(positionEncodings)
+ # end
+ positionEncoding = PositionEncodingKind.UTF16
     state.encoding = positionEncoding
 
     result = InitializeResult(;

```

If the error goes away, that confirms the issue lives on the eglot side, and we can take it upstream from there.

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [May 6, 2026, 11:57am UTC](https://discourse.julialang.org/t/looking-for-emacs-users-to-help-me-debug-an-issue-with-emacs-eglot-and-jetls/136987/4 "2026-05-06T11:57:23Z")

</div>

Thanks for looking into this, and the hint above. Unfortunately, with the patch above I run into another error, not being able to start jsonrpc:

```julia-auto
Debugger entered--Lisp error: (error "[jsonrpc] Could not start and/or connect")
  error("[jsonrpc] Could not start and/or connect")
  #f(compiled-function () #<bytecode 0x162a403f347a5cc3>)()
  #f(compiled-function (conn) #<bytecode -0x12ca85559dddb8ac>)(#<eglot-lsp-server eglot-lsp-server-1e0112a0638f>)
  #f(compiled-function (conn slots) #<bytecode 0x11900d17e27cb127>)(#<eglot-lsp-server eglot-lsp-server-1e0112a0638f> (:name "EGLOT (jetls-mwe/(julia-mode julia-ts-mode))" :events-buffer-config (:size 2000000 :format full) :notification-dispatcher #f(compiled-function (server method params) #<bytecode 0x1f2ccd80f82948aa>) :request-dispatcher #f(compiled-function (server method params) #<bytecode 0x1f2ccd80e62948aa>) :on-shutdown eglot--on-shutdown :process #f(compiled-function (conn) #<bytecode -0x12ca85559dddb8ac>)))
  apply(#f(compiled-function (conn slots) #<bytecode 0x11900d17e27cb127>) (#<eglot-lsp-server eglot-lsp-server-1e0112a0638f> (:name "EGLOT (jetls-mwe/(julia-mode julia-ts-mode))" :events-buffer-config (:size 2000000 :format full) :notification-dispatcher #f(compiled-function (server method params) #<bytecode 0x1f2ccd80f82948aa>) :request-dispatcher #f(compiled-function (server method params) #<bytecode 0x1f2ccd80e62948aa>) :on-shutdown eglot--on-shutdown :process #f(compiled-function (conn) #<bytecode -0x12ca85559dddb8ac>))))
  #f(compiled-function (&rest args) #<bytecode -0x10f10a0df0dd61f4>)(#<eglot-lsp-server eglot-lsp-server-1e0112a0638f> (:name "EGLOT (jetls-mwe/(julia-mode julia-ts-mode))" :events-buffer-config (:size 2000000 :format full) :notification-dispatcher #f(compiled-function (server method params) #<bytecode 0x1f2ccd80f82948aa>) :request-dispatcher #f(compiled-function (server method params) #<bytecode 0x1f2ccd80e62948aa>) :on-shutdown eglot--on-shutdown :process #f(compiled-function (conn) #<bytecode -0x12ca85559dddb8ac>)))
  apply(#f(compiled-function (&rest args) #<bytecode -0x10f10a0df0dd61f4>) #<eglot-lsp-server eglot-lsp-server-1e0112a0638f> (:name "EGLOT (jetls-mwe/(julia-mode julia-ts-mode))" :events-buffer-config (:size 2000000 :format full) :notification-dispatcher #f(compiled-function (server method params) #<bytecode 0x1f2ccd80f82948aa>) :request-dispatcher #f(compiled-function (server method params) #<bytecode 0x1f2ccd80e62948aa>) :on-shutdown eglot--on-shutdown :process #f(compiled-function (conn) #<bytecode -0x12ca85559dddb8ac>)))
  initialize-instance(#<eglot-lsp-server eglot-lsp-server-1e0112a0638f> (:name "EGLOT (jetls-mwe/(julia-mode julia-ts-mode))" :events-buffer-config (:size 2000000 :format full) :notification-dispatcher #f(compiled-function (server method params) #<bytecode 0x1f2ccd80f82948aa>) :request-dispatcher #f(compiled-function (server method params) #<bytecode 0x1f2ccd80e62948aa>) :on-shutdown eglot--on-shutdown :process #f(compiled-function (conn) #<bytecode -0x12ca85559dddb8ac>)))
  #f(compiled-function (class &rest slots) "Default constructor for CLASS `eieio-default-superclass'.\nSLOTS are the initialization slots used by `initialize-instance'.\nThis static method is called when an object is constructed.\nIt allocates the vector used to represent an EIEIO object, and then\ncalls `initialize-instance' on that object." #<bytecode 0x9edf507a1ea8541>)(eglot-lsp-server :name "EGLOT (jetls-mwe/(julia-mode julia-ts-mode))" :events-buffer-config (:size 2000000 :format full) :notification-dispatcher #f(compiled-function (server method params) #<bytecode 0x1f2ccd80f82948aa>) :request-dispatcher #f(compiled-function (server method params) #<bytecode 0x1f2ccd80e62948aa>) :on-shutdown eglot--on-shutdown :process #f(compiled-function (conn) #<bytecode -0x12ca85559dddb8ac>))
  apply(#f(compiled-function (class &rest slots) "Default constructor for CLASS `eieio-default-superclass'.\nSLOTS are the initialization slots used by `initialize-instance'.\nThis static method is called when an object is constructed.\nIt allocates the vector used to represent an EIEIO object, and then\ncalls `initialize-instance' on that object." #<bytecode 0x9edf507a1ea8541>) eglot-lsp-server (:name "EGLOT (jetls-mwe/(julia-mode julia-ts-mode))" :events-buffer-config (:size 2000000 :format full) :notification-dispatcher #f(compiled-function (server method params) #<bytecode 0x1f2ccd80f82948aa>) :request-dispatcher #f(compiled-function (server method params) #<bytecode 0x1f2ccd80e62948aa>) :on-shutdown eglot--on-shutdown :process #f(compiled-function (conn) #<bytecode -0x12ca85559dddb8ac>)))
  make-instance(eglot-lsp-server :name "EGLOT (jetls-mwe/(julia-mode julia-ts-mode))" :events-buffer-config (:size 2000000 :format full) :notification-dispatcher #f(compiled-function (server method params) #<bytecode 0x1f2ccd80f82948aa>) :request-dispatcher #f(compiled-function (server method params) #<bytecode 0x1f2ccd80e62948aa>) :on-shutdown eglot--on-shutdown :process #f(compiled-function (conn) #<bytecode -0x12ca85559dddb8ac>))
  apply(make-instance eglot-lsp-server :name "EGLOT (jetls-mwe/(julia-mode julia-ts-mode))" :events-buffer-config (:size 2000000 :format full) :notification-dispatcher #f(compiled-function (server method params) #<bytecode 0x1f2ccd80f82948aa>) :request-dispatcher #f(compiled-function (server method params) #<bytecode 0x1f2ccd80e62948aa>) :on-shutdown eglot--on-shutdown (:process #f(compiled-function (conn) #<bytecode -0x12ca85559dddb8ac>)))
  eglot--connect((julia-mode julia-ts-mode) (vc Git "~/code/elisp/jetls-mwe/") eglot-lsp-server ("/home/tamas/.juliaup/bin/julia +1.12 --startup-file=no --project=/home/tamas/src/JETLS.jl -m JETLS serve" "serve" "--socket" :autoport) ("julia" "julia"))
  apply(eglot--connect ((julia-mode julia-ts-mode) (vc Git "~/code/elisp/jetls-mwe/") eglot-lsp-server ("/home/tamas/.juliaup/bin/julia +1.12 --startup-file=no --project=/home/tamas/src/JETLS.jl -m JETLS serve" "serve" "--socket" :autoport) ("julia" "julia")))
  #f(compiled-function () #<bytecode -0x12ad5ac15af6be45>)()

```

In any case I opened an eglot issue at

> <https://github.com/joaotavora/eglot/issues/1588>
>
> I am running into a bug with Julia, JETLS, and eglot. Specifically, with code th…at has UTF8 characters, I get error messages for warnings with backtraces like
> 
> \`\`\`
> Debugger entered--Lisp error: (args-out-of-range "inplace\_∂g∂x\_v!(x)" 20 21)
> \`\`\`
> 
> \## MRE
> 
> 1. install \[Julia\](https://github.com/JuliaLang/juliaup#installation)
> 2. install \[JETLS\](https://aviatesk.github.io/JETLS.jl/release/#index/server-installation/install)
> 3. clone \[this repo\](https://github.com/tpapp/eglot-problem-mwe) for a minimal reproducible environment (made with using \`straight.el\`, to fix exact package versions), has a demo Julia file that reproduces
> 4. start Emacs with the \`./run.sh\` from the repo, opening \`file.jl\`, you will see the backtrace (attached)
> 
> \## Previous discussion
> 
> @aviatesk, the maintainer of JETLS, \[suggests\](https://discourse.julialang.org/t/looking-for-emacs-users-to-help-me-debug-an-issue-with-emacs-eglot-and-jetls/136987/3?u=tamas\_papp) that this may be an UTF8/UTF16 issue.

Those of you who know about the intricacies of the protocol should maybe comment there, I guess it is rare for languages to support Unicode natively so Julia may testing code paths that were previously unused.

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [May 6, 2026, 1:24pm UTC](https://discourse.julialang.org/t/looking-for-emacs-users-to-help-me-debug-an-issue-with-emacs-eglot-and-jetls/136987/5 "2026-05-06T13:24:19Z")

</div>

Addendum: apparently before LanguageServer 3.17, the [only encoding option was UTF16](https://maximsmol.github.io/vscode-languageserver-node/interfaces/Position-1.html).

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [May 6, 2026, 1:29pm UTC](https://discourse.julialang.org/t/looking-for-emacs-users-to-help-me-debug-an-issue-with-emacs-eglot-and-jetls/136987/6 "2026-05-06T13:29:23Z")

</div>

@aviatesk, in the original issue you said that you cannot replicate, so there must be something different in your config compared to the MWE in the repo. If you could tell me what it is, I could use that as a workaround.

---

<div class="post-metadata">

**Author:** ![Ralph\_Smith](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ralph_smith/32/10344_2.png) [@Ralph\_Smith](https://discourse.julialang.org/u/Ralph_Smith)\
**Post date:** [May 7, 2026, 1:03am UTC](https://discourse.julialang.org/t/looking-for-emacs-users-to-help-me-debug-an-issue-with-emacs-eglot-and-jetls/136987/7 "2026-05-07T01:03:58Z")

</div>

When I run your script using emacs 30.2, I do not encounter the error, only a minor warning from flymake. Perhaps noteworthy is that the eglot events buffer shows ∂ in the function name as three octal bytes rather than the unicode glyph.  
Edit: I am using jetls version 2026-05-06.

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [May 7, 2026, 8:25am UTC](https://discourse.julialang.org/t/looking-for-emacs-users-to-help-me-debug-an-issue-with-emacs-eglot-and-jetls/136987/8 "2026-05-07T08:25:57Z")

</div>

> [@Ralph\_Smith](#):
>
> I do not encounter the error

You mean that when you go to the relevant line (line 6), to display the entire message, it works OK?

If yes, please share the details of your config, ie the relevant package versions for

- eldoc
- external-completion
- flymake
- jsonrpc
- project
- seq
- xref

and also your eglot/jetls setup customizations, if any.

Since not everyone is able to replicate this bug, I suspect that there is a configuration that works.

---

<div class="post-metadata">

**Author:** ![Ralph\_Smith](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ralph_smith/32/10344_2.png) [@Ralph\_Smith](https://discourse.julialang.org/u/Ralph_Smith)\
**Post date:** [May 7, 2026, 7:27pm UTC](https://discourse.julialang.org/t/looking-for-emacs-users-to-help-me-debug-an-issue-with-emacs-eglot-and-jetls/136987/9 "2026-05-07T19:27:27Z")

</div>

I am using the `straight` setup from your MWE repo for this test. When I try it again today, I **do** encounter the indexing error when the cursor is over the function name on line 6; I don’t understand why I didn’t see it yesterday. Sorry for the noise if I simply didn’t test it correctly.

Anyway, you can obviate this particular error by adding `:signatureHelpProvider` to the `eglot-ignored-server-capabilities` variable (which is accessible from the emacs customization menu).

Also, “[jsonrpc] Could not start and/or connect” may just be a timeout problem. If so, you can manually re-invoke `M-x eglot` for the buffer, and `jetls` will restart more quickly (with cached library files, etc.)
