python / python/mypy

sqlite3.OperationalError: disk I/O error

Open
#22,010 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

crash topic-incremental
Dominant language
Python
Stars
20.6k
Forks
3.3k
PR merge metrics
PR metrics pending

Description

Crash Report

$ mypy . --show-traceback
error: INTERNAL ERROR -- Please try using mypy master on GitHub:
https://mypy.readthedocs.io/en/stable/common_issues.html#using-a-development-mypy-build
Please report a bug at https://github.com/python/mypy/issues
version: 2.3.1
Traceback (most recent call last):
  File "/tmp/py/lib/python3.14/site-packages/mypy/__main__.py", line 16, in console_entry
    main()
    ~~~~^^
  File "mypy/main.py", line 154, in main
  File "mypy/main.py", line 244, in run_build
    res = build.build(sources, options, None, flush_errors, fscache, stdout, stderr)
  File "mypy/build.py", line 385, in build
  File "mypy/build.py", line 1908, in create_metastore
    mds: MetadataStore = SqliteMetadataStore(
  File "mypy/metastore.py", line 200, in __init__
  File "mypy/metastore.py", line 172, in connect_db
    db.execute("PRAGMA synchronous=OFF")
sqlite3.OperationalError: disk I/O error

note: use --pdb to drop into pdb

To Reproduce

Source files are in a network mount:

$ mount | grep src
src on /home/hugo/src type 9p (rw,relatime,access=client,trans=virtio)

Sources are readable, execute fine, can be checked with ruff, etc.

You can quickly run a VM to reproduce this via:

qemu-system-x86_64 \
	--enable-kvm \
	-nic user \
	-nographic \
	-m 4G \
	-smp cores=2 \
        -drive file=alpine-virt-3.24.1-x86_64.iso,format=raw \                                                                                                                                                                                 
	-virtfs local,path=$HOME/src/,mount_tag=src,security_model=mapped-xattr

Then install mypy, mount the shared filesystem, and run it on any code in that fs.

Your Environment

  • Mypy version used: mypy 2.3.1 (compiled: yes)
  • Mypy command-line flags: (none/any)
  • Mypy configuration options from mypy.ini (and other config files): irrelevant; always happens
  • Python version used: Python 3.14.7
  • Operating system and version: Alpine Linux Edge

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 with mypy/metastore.py, especially connect_db and create_metastore, where the traceback reaches PRAGMA synchronous=OFF. Reproduce with the supplied Alpine VM and 9p-mounted source tree, then inspect how the metadata database behaves on that mount. Done should mean checking mypy no longer terminates with this internal sqlite3.OperationalError in the reported environment.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, sqlite
Domain
databases, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Needs clarification
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.