Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error running timer ‘lsp--on-idle’: (error "Undefined error level: lsp-flycheck-info-unnecessary") #16224

Closed
tanj opened this issue Dec 29, 2023 · 8 comments

Comments

@tanj
Copy link

tanj commented Dec 29, 2023

Description :octocat:

When opening a file that uses an lsp mode no debug information is shown.

Reproduction guide 🪲

  • Start Emacs
  • Open file that uses an lsp mode

Observed behaviour: 👀 💔

LSP :: Connected to [ts-ls:48516 <project path>].
Error running timer ‘lsp--on-idle’: (error "Undefined error level: lsp-flycheck-info-unnecessary")

Expected behaviour: ❤️ 😄

no error message and any lsp errors or info shown

System Info 💻

  • OS: windows-nt
  • Emacs: 29.1
  • Spacemacs: 0.999.0
  • Spacemacs branch: develop (rev. b2511bb)
  • Graphic display: t
  • Running in daemon: nil
  • Distribution: spacemacs
  • Editing style: emacs
  • Completion: helm
  • Layers:
((typescript :variables typescript-fmt-tool 'prettier typescript-fmt-on-save t typescript-linter 'eslint typescript-backend 'lsp)
 javascript sql html ansible csv yaml rust auto-completion
 (c-c++ :variables c-c++-default-mode-for-headers 'c++-mode)
 better-defaults emacs-lisp
 (helm :variables helm-buffer-max-length 80)
 lsp
 (python :variables python-formatter 'black python-format-on-save t python-backend 'lsp)
 markdown multiple-cursors latex org
 (spell-checking :variables spell-checking-enable-by-default nil)
 syntax-checking treemacs)
  • System configuration features: ACL GIF GMP GNUTLS HARFBUZZ JPEG JSON LCMS2 LIBXML2 MODULES NATIVE_COMP NOTIFY W32NOTIFY PDUMPER PNG RSVG SOUND SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS TREE_SITTER WEBP XPM ZLIB

Backtrace 🐾

Debugger entered--Lisp error: (error "Undefined error level: lsp-flycheck-info-unnecessa...")
  signal(error ("Undefined error level: lsp-flycheck-info-unnecessa..."))
  (condition-case err (let* ((checker (flycheck-get-checker-for-buffer))) (if checker (flycheck-start-current-syntax-check checker) (flycheck-clear) (flycheck-report-status 'no-checker))) (error (flycheck-report-failed-syntax-check) (signal (car err) (cdr err))))
  (if (flycheck-running-p) nil (run-hooks 'flycheck-before-syntax-check-hook) (flycheck-clear-errors) (flycheck-mark-all-overlays-for-deletion) (condition-case err (let* ((checker (flycheck-get-checker-for-buffer))) (if checker (flycheck-start-current-syntax-check checker) (flycheck-clear) (flycheck-report-status 'no-checker))) (error (flycheck-report-failed-syntax-check) (signal (car err) (cdr err)))))
  (if flycheck-mode (if (flycheck-running-p) nil (run-hooks 'flycheck-before-syntax-check-hook) (flycheck-clear-errors) (flycheck-mark-all-overlays-for-deletion
Debugger entered--Lisp error: (error "Undefined error level: lsp-flycheck-info-unnecessa...")
  signal(error ("Undefined error level: lsp-flycheck-info-unnecessa..."))
  (condition-case err (let* ((checker (flycheck-get-checker-for-buffer))) (if checker (flycheck-start-current-syntax-check checker) (flycheck-clear) (flycheck-report-status 'no-checker))) (error (flycheck-report-failed-syntax-check) (signal (car err) (cdr err))))
  (if (flycheck-running-p) nil (run-hooks 'flycheck-before-syntax-check-hook) (flycheck-clear-errors) (flycheck-mark-all-overlays-for-deletion) (condition-case err (let* ((checker (flycheck-get-checker-for-buffer))) (if checker (flycheck-start-current-syntax-check checker) (flycheck-clear) (flycheck-report-status 'no-checker))) (error (flycheck-report-failed-syntax-check) (signal (car err) (cdr err)))))
  (if flycheck-mode (if (flycheck-running-p) nil (run-hooks 'flycheck-before-syntax-check-hook) (flycheck-clear-errors) (flycheck-mark-all-overlays-for-deletion) (condition-case err (let* ((checker (flycheck-get-checker-for-buffer))) (if checker (flycheck-start-current-syntax-check checker) (flycheck-clear) (flycheck-report-status 'no-checker))) (error (flycheck-report-failed-syntax-check) (signal (car err) (cdr err))))) (user-error "Flycheck mode disabled"))
  flycheck-buffer()
  lsp-diagnostics--flycheck-buffer()
  run-hooks(lsp-on-idle-hook)
  lsp--on-idle(#<buffer lister.component.ts>)
  #f(compiled-function () #<bytecode 0x16d0b3b5906a936d>)()
  apply(#f(compiled-function () #<bytecode 0x16d0b3b5906a936d>) nil)
  timer-event-handler([t 0 0 0 nil #f(compiled-function () #<bytecode 0x16d0b3b5906a936d>) nil idle 0 nil])
@smile13241324
Copy link
Collaborator

I cannot reproduce your issue, I have opened a simple test js file and the lsp layer was working fine. Please provide more infos for reproduction.

@tanj
Copy link
Author

tanj commented Jan 3, 2024

So, one thing I noticed over the last few days is that it isn't with every file. It was happening with with seemingly any lsp I use.

  • typescript
  • rust
  • python

I'm trying to make a reproducible case, but it seems to be somewhat temperamental... Ok, this one seems to work for me consistently.

  1. git clone https://github.com/helix-editor/helix.git
  2. Open emacs (assuming rust layer enabled and rust-analyzer installed)
  3. open helix/helix-term/src/application.rs
  4. wait for lsp to load completely
  5. make a change to trigger lsp (I inserted a space at the beginning of a line and then deleted it)
  6. Error running timer message occurs

@smile13241324
Copy link
Collaborator

I have followed your instructions but I seem to not get the same error, however I have seen a suspicious error for an invalid face for lsp-flycheck-info-unnecessary.

I have searched that string in our code and did not find it, I am afraid this error comes from lsp-mode or lsp-server itself. I have seen a similar issue with the java lsp at work but have hoped this would only be an issue of my outdated installation. Once I have updated my work environment I may be able to provide some more diagnostics for now I am clueless.

@alexey0308
Copy link

alexey0308 commented Jan 25, 2024

Hi @tanj, please take a look at emacs-lsp/lsp-mode#2255

it looks like an upstream issue and there is a comment with temporary solution linked PR to it.

@tanj
Copy link
Author

tanj commented Jan 26, 2024

I have the temporary fix in my config already, but it doesn't fix the error. My issue is talking about an undefined error level, not an undefined face. It could be that this is adjacent to that issue and be fully upstream and not a spacemacs issue.

@tanj tanj closed this as completed Jan 26, 2024
@vjohansen
Copy link

@tanj What was your temporary fix? I have the same issue (not spacemacs, regular Emacs 29)

@tanj
Copy link
Author

tanj commented Apr 23, 2024

@vjohansen

;; https://github.com/emacs-lsp/lsp-mode/issues/2255#issuecomment-1786355147
(defface lsp-flycheck-info-unnecessary
    '((t))
    "Face which apply to side line for symbols not used.
Possibly erroneously redundant of lsp-flycheck-info-unnecessary-face."
    :group 'lsp-ui-sideline)

This didn't fix this exact issue tho. It only fixed the undefined face issue.

@charlesd-tm
Copy link

In case anyone else is seeing this error "Undefined error level: lsp-flycheck-info-unnecessary", the cause is the workaround to the previous bug.

It happens when you have upgraded lsp to include the bugfix for the use of lsp-flycheck-info-unnecessary as the name of a face, and now the code will try to use that name for an error level. But if it is already defined as a face (due to the previous workaround), then it will not redefine it as an error level and that causes an error.

So if you are seeing the error-level error, then remove the "defface" workaround from your init file, and restart and it should work again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants