Skip to content

[bug] Crash when fetching incomplete completer metadata #1933

@scottnemes

Description

@scottnemes

Suggested troubleshooting steps for bug reports

  • Upgraded to the latest mycli if possible.
  • Ran mycli --checkup, if supported.

Expected Behavior

mycli> USE db;
mycli> SELECT ..

Not crash

Actual Behavior

mycli> USE db;
mycli> SELECT ..

Crashes

Unhandled exception in event loop:
  File "/opt/homebrew/Cellar/mycli/1.74.0/libexec/lib/python3.14/site-packages/prompt_toolkit/buffer.py", line 1923, in new_coroutine
    await coroutine(*a, **kw)
  File "/opt/homebrew/Cellar/mycli/1.74.0/libexec/lib/python3.14/site-packages/prompt_toolkit/buffer.py", line 1740, in async_completer
    async for completion in async_generator:
    ...<12 lines>...
            break
  File "/opt/homebrew/Cellar/mycli/1.74.0/libexec/lib/python3.14/site-packages/prompt_toolkit/completion/base.py", line 310, in get_completions_async
    async for completion in completer.get_completions_async(
    ...<2 lines>...
        yield completion
  File "/opt/homebrew/Cellar/mycli/1.74.0/libexec/lib/python3.14/site-packages/prompt_toolkit/completion/base.py", line 268, in get_completions_async
    async for completion in async_generator:
        yield completion
  File "/opt/homebrew/Cellar/mycli/1.74.0/libexec/lib/python3.14/site-packages/prompt_toolkit/eventloop/async_generator.py", line 125, in generator_to_async_generator
    await runner_f
  File "/opt/homebrew/Cellar/python@3.14/3.14.5/Frameworks/Python.framework/Versions/3.14/lib/python3.14/concurrent/futures/thread.py", line 86, in run
    result = ctx.run(self.task)
  File "/opt/homebrew/Cellar/python@3.14/3.14.5/Frameworks/Python.framework/Versions/3.14/lib/python3.14/concurrent/futures/thread.py", line 73, in run
    return fn(*args, **kwargs)
  File "/opt/homebrew/Cellar/mycli/1.74.0/libexec/lib/python3.14/site-packages/prompt_toolkit/eventloop/async_generator.py", line 78, in runner
    for item in get_iterable():
                ~~~~~~~~~~~~^^
  File "/opt/homebrew/Cellar/mycli/1.74.0/libexec/lib/python3.14/site-packages/prompt_toolkit/completion/base.py", line 265, in <lambda>
    lambda: self.completer.get_completions(document, complete_event)
            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/mycli/1.74.0/libexec/lib/python3.14/site-packages/prompt_toolkit/completion/base.py", line 303, in get_completions
    return completer.get_completions(document, complete_event)
           ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/mycli/1.74.0/libexec/lib/python3.14/site-packages/mycli/sqlcompleter.py", line 1442, in get_completions
    scoped_cols = self.populate_scoped_cols(tables)
  File "/opt/homebrew/Cellar/mycli/1.74.0/libexec/lib/python3.14/site-packages/mycli/sqlcompleter.py", line 1757, in populate_scoped_cols
    for table in meta["tables"][self.dbname]:
                 ~~~~~~~~~~~~~~^^^^^^^^^^^^^

Steps to Reproduce

See above. Only happens when the background thread is taking a while, which is hard to reproduce unless you have a large MySQL database and/or a slow system.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions