python / python/mypy

dmypy "Daemon crashed!" with KeyError: 'sqlalchemy.orm'

Open
#9,366 17 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

crash priority-0-high topic-daemon
Dominant language
Python
Stars
20.6k
Forks
3.3k
PR merge metrics
PR metrics pending

Description

Below is a repeatable dmypy invokation sequence showing a crash due to KeyError. Is there a way to get better debug output to help resolve this?

$ dmypy run -- --config-file /home/russ/pcode/edms/server/../env/mypy.ini --strict /home/russ/pcode/edms/server/deleteme.py 
Daemon started
deleteme.py:3:3: error: Unsupported operand types for + ("int" and "str")  [operator]
Found 1 error in 1 file (checked 21 source files)
$
$ dmypy run -- --config-file /home/russ/pcode/edms/server/../env/mypy.ini --strict /home/russ/pcode/edms/server/deleteme.py 
deleteme.py:3:3: error: Unsupported operand types for + ("int" and "str")  [operator]
Found 1 error in 1 file (checked 1 source file)
$
$ dmypy run -- --config-file /home/russ/pcode/edms/server/../env/mypy.ini --strict /home/russ/pcode/edms/server/deleteme.py 
deleteme.py:3:3: error: Unsupported operand types for + ("int" and "str")  [operator]
Found 1 error in 1 file (checked 1 source file)
$
$ dmypy run -- --config-file /home/russ/pcode/edms/server/../env/mypy.ini --strict /home/russ/pcode/edms/shared/deployment_check/deployment_check.py 
Success: no issues found in 1 source file
$
$ dmypy run -- --config-file /home/russ/pcode/edms/server/../env/mypy.ini --strict /home/russ/pcode/edms/server/server/EventLogger.py 
Daemon crashed!
Traceback (most recent call last):
  File "mypy/dmypy_server.py", line 223, in serve
  File "mypy/dmypy_server.py", line 266, in run_command
  File "mypy/dmypy_server.py", line 325, in cmd_run
  File "mypy/dmypy_server.py", line 387, in check
  File "mypy/dmypy_server.py", line 561, in fine_grained_increment_follow_imports
  File "mypy/dmypy_server.py", line 686, in direct_imports
KeyError: 'sqlalchemy.orm'

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the command sequence in the issue with dmypy and the shown configuration and source paths. Inspect mypy/dmypy_server.py around fine_grained_increment_follow_imports, direct_imports, and the reported KeyError for sqlalchemy.orm. Done means the daemon no longer crashes and provides useful diagnostic output for this case.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, sqlalchemy
Domain
devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.