FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

corrupt cache causes alarming message · Issue #22220 · python/mypy · GitHub

Repository navigation

corrupt cache causes alarming message #22220

Open

Description

sometimes my host corrupts my cache because i keep it in /tmp. removing it always restores expected behavior.

i think the error message printed in this scenario is more alarming than necessary. would it be easy to detect cache import errors and suggest retrying after removing the cache? (automatically removing corrupt caches would be nice, but this scenario is too rare to justify that effort.)

Your Environment

  • Mypy version used: 2.4.0
  • Mypy command-line flags: --cache-dir $TMP_DIR/.mypy_cache --fixed-format-cache
  • Mypy configuration options from mypy.ini (and other config files): N/A
  • Python version used: 3.14.7

Stack Trace

/Users/cossor/Library/Python/3.14/lib/python/site-packages/mypy/typeshed/stdlib/zipimport.pyi:9: 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.4.0
Traceback (most recent call last):
  File "/Users/cossor/Library/Python/3.14/bin/mypy", line 6, in <module>
    sys.exit(console_entry())
  File "/Users/cossor/Library/Python/3.14/lib/python/site-packages/mypy/__main__.py", line 16, in console_entry
    main()
  File "/Users/cossor/Library/Python/3.14/lib/python/site-packages/mypy/main.py", line 167, in main
    res, messages, blockers = run_build(sources, options, fscache, t0, stdout, stderr)
  File "/Users/cossor/Library/Python/3.14/lib/python/site-packages/mypy/main.py", line 257, in run_build
    res = build.build(sources, options, None, flush_errors, fscache, stdout, stderr)
  File "/Users/cossor/Library/Python/3.14/lib/python/site-packages/mypy/build.py", line 425, in build
    result = build_inner(
  File "/Users/cossor/Library/Python/3.14/lib/python/site-packages/mypy/build.py", line 540, in build_inner
    graph = dispatch(sources, manager, stdout, connect_threads)
  File "/Users/cossor/Library/Python/3.14/lib/python/site-packages/mypy/build.py", line 4199, in dispatch
    process_graph(graph, manager)
  File "/Users/cossor/Library/Python/3.14/lib/python/site-packages/mypy/build.py", line 4667, in process_graph
    done, still_working, results = manager.wait_for_done(graph)
  File "/Users/cossor/Library/Python/3.14/lib/python/site-packages/mypy/build.py", line 1478, in wait_for_done
    process_stale_scc(graph, next_scc, self)
  File "/Users/cossor/Library/Python/3.14/lib/python/site-packages/mypy/build.py", line 4831, in process_stale_scc
    scc_result = process_stale_scc_interface(
  File "/Users/cossor/Library/Python/3.14/lib/python/site-packages/mypy/build.py", line 4986, in process_stale_scc_interface
    graph[id].type_check_first_pass(recurse_into_functions=False)
  File "/Users/cossor/Library/Python/3.14/lib/python/site-packages/mypy/build.py", line 3457, in type_check_first_pass
    self.type_checker().check_first_pass(recurse_into_functions=recurse_into_functions)
  File "/Users/cossor/Library/Python/3.14/lib/python/site-packages/mypy/checker.py", line 634, in check_first_pass
    self.accept(d)
  File "/Users/cossor/Library/Python/3.14/lib/python/site-packages/mypy/checker.py", line 781, in accept
    stmt.accept(self)
  File "/Users/cossor/Library/Python/3.14/lib/python/site-packages/mypy/nodes.py", line 1917, in accept
    return visitor.visit_assignment_stmt(self)
  File "/Users/cossor/Library/Python/3.14/lib/python/site-packages/mypy/checker.py", line 3398, in visit_assignment_stmt
    self.check_assignment(s.lvalues[-1], s.rvalue, s.type is None)
  File "/Users/cossor/Library/Python/3.14/lib/python/site-packages/mypy/checker.py", line 3616, in check_assignment
    rvalue_type = self.expr_checker.accept(rvalue, type_context=type_context)
  File "/Users/cossor/Library/Python/3.14/lib/python/site-packages/mypy/checkexpr.py", line 6251, in accept
    typ = self.accept_maybe_cache(node, type_context=type_context)
  File "/Users/cossor/Library/Python/3.14/lib/python/site-packages/mypy/checkexpr.py", line 6286, in accept_maybe_cache
    typ = node.accept(self)
  File "/Users/cossor/Library/Python/3.14/lib/python/site-packages/mypy/nodes.py", line 2922, in accept
    return visitor.visit_list_expr(self)
           ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/Users/cossor/Library/Python/3.14/lib/python/site-packages/mypy/checkexpr.py", line 5202, in visit_list_expr
    return self.check_lst_expr(e, "builtins.list", "<list>")
           ~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/cossor/Library/Python/3.14/lib/python/site-packages/mypy/checkexpr.py", line 5286, in check_lst_expr
    out = self.check_call(
          ~~~~~~~~~~~~~~~^
        constructor,
        ^^^^^^^^^^^^
    ...<2 lines>...
        e,
        ^^
    )[0]
    ^
  File "/Users/cossor/Library/Python/3.14/lib/python/site-packages/mypy/checkexpr.py", line 1594, in check_call
    return self.check_callable_call(
           ~~~~~~~~~~~~~~~~~~~~~~~~^
        callee,
        ^^^^^^^
    ...<6 lines>...
        object_type,
        ^^^^^^^^^^^^
    )
    ^
  File "/Users/cossor/Library/Python/3.14/lib/python/site-packages/mypy/checkexpr.py", line 1772, in check_callable_call
    callee = self.infer_function_type_arguments_using_context(callee, context)
  File "/Users/cossor/Library/Python/3.14/lib/python/site-packages/mypy/checkexpr.py", line 2160, in infer_function_type_arguments_using_context
    return self.apply_generic_arguments(
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
        callable, new_args, error_context, skip_unsatisfied=True
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/Users/cossor/Library/Python/3.14/lib/python/site-packages/mypy/checkexpr.py", line 3394, in apply_generic_arguments
    return applytype.apply_generic_arguments(
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
        callable,
        ^^^^^^^^^
    ...<3 lines>...
        skip_unsatisfied=skip_unsatisfied,
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/Users/cossor/Library/Python/3.14/lib/python/site-packages/mypy/applytype.py", line 117, in apply_generic_arguments
    target_type = get_target_type(
        tvar,
    ...<5 lines>...
        id_to_type,
    )
  File "/Users/cossor/Library/Python/3.14/lib/python/site-packages/mypy/applytype.py", line 81, in get_target_type
    if not mypy.subtypes.is_subtype(type, upper_bound):
           ~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^
  File "/Users/cossor/Library/Python/3.14/lib/python/site-packages/mypy/subtypes.py", line 194, in is_subtype
    return _is_subtype(left, right, subtype_context, proper_subtype=False)
  File "/Users/cossor/Library/Python/3.14/lib/python/site-packages/mypy/subtypes.py", line 381, in _is_subtype
    return left.accept(SubtypeVisitor(orig_right, subtype_context, proper_subtype))
           ~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/cossor/Library/Python/3.14/lib/python/site-packages/mypy/types.py", line 1702, in accept
    return visitor.visit_instance(self)
           ~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/Users/cossor/Library/Python/3.14/lib/python/site-packages/mypy/subtypes.py", line 540, in visit_instance
    if not self.subtype_context.ignore_promotions and not right.type.is_protocol:
                                                          ^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/cossor/Library/Python/3.14/lib/python/site-packages/mypy/nodes.py", line 4487, in __getattribute__
    raise AssertionError(object.__getattribute__(self, "msg"))
AssertionError: De-serialization failure: TypeInfo not fixed

/Users/cossor/Library/Python/3.14/lib/python/site-packages/mypy/typeshed/stdlib/zipimport.pyi:9: note: use --pdb to drop into pdb

Activity

  1. inchang-ing commented on Oct 18, 2026

    Contributor

    Happy to take a look. The unactionable INTERNAL ERROR comes from uncaught exceptions while reading/importing cache metadata, so the fix shape would be catching cache-import failures at the build entry point and reporting them as a normal error that suggests removing --cache-dir and retrying, instead of the bug-report boilerplate. I'll prepare a PR along those lines.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugmypy got something wrong

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions


      Back | FazBrowse Home | New Git URL