INTERNAL Error: Attempted to access index 1 within vector of size 1
on startup from new install
#643
-
Before Proceeding, please acknowledge:
Describe the bug I've tried a variety of variations but harlequin is always crashing on start for me. The simplest/most isolated version seems to be to run in docker as described below: To Reproduce ❯ docker run -it --rm python:3.12 /bin/sh
# pip install harlequin
Collecting harlequin
Downloading harlequin-1.24.0-py3-none-any.whl.metadata (5.1 kB)
...
Installing collected packages: wcwidth, pyperclip, uc-micro-py, typing-extensions, tqdm, tomlkit, setuptools, pygments, prompt_toolkit, platformdirs, numpy, mdurl, MarkupSafe, duckdb, click, tree-sitter, questionary, pyarrow, markdown-it-py, linkify-it-py, jinja2, tree-sitter-languages, shandy-sqlfmt, rich, mdit-py-plugins, rich-click, textual, textual-fastdatatable, textual-textarea, harlequin
Successfully installed MarkupSafe-2.1.5 click-8.1.7 duckdb-1.1.0 harlequin-1.24.0 jinja2-3.1.4 linkify-it-py-2.0.3 markdown-it-py-3.0.0 mdit-py-plugins-0.4.1 mdurl-0.1.2 numpy-1.26.4 platformdirs-4.3.2 prompt_toolkit-3.0.36 pyarrow-17.0.0 pygments-2.18.0 pyperclip-1.9.0 questionary-2.0.1 rich-13.8.0 rich-click-1.8.3 setuptools-74.1.2 shandy-sqlfmt-0.23.2 textual-0.76.0 textual-fastdatatable-0.9.0 textual-textarea-0.14.2 tomlkit-0.13.2 tqdm-4.66.5 tree-sitter-0.20.4 tree-sitter-languages-1.10.2 typing-extensions-4.12.2 uc-micro-py-1.0.3 wcwidth-0.2.13
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager, possibly rendering your system unusable.It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv. Use the --root-user-action option if you know what you are doing and want to suppress this warning.
# harlequin
...
InternalException: INTERNAL Error: Attempted to access index 1 within vector of size 1
This error signals an assertion failure within DuckDB. This usually occurs due to unexpected conditions or errors in the program's logic.
For more information, see https://duckdb.org/docs/dev/internal_errors full dump of the output is:╭─ System Locale Not Set ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │ Harlequin uses the locale of your device to format numbers. │ │ │ │ Your device's locale is set to C.UTF-8, which is a POSIX locale for computers, not humans. │ │ │ │ To see thousands separators in Harlequin, set your system locale, following instructions for your OS, or pass a locale string to Harlequin using the --locale │ │ option. To suppress this warning, run Harlequin with the --locale C option. │ │ │ │ See also https://harlequin.sh/docs/troubleshooting/locale │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ ╭────────────────────────────────────────────────────────────── Traceback (most recent call last) ───────────────────────────────────────────────────────────────╮ │ /usr/local/lib/python3.12/site-packages/textual/worker.py:368 in _run │ │ │ │ 365 │ │ self.state = WorkerState.RUNNING │ │ 366 │ │ app.log.worker(self) │ │ 367 │ │ try: │ │ ❱ 368 │ │ │ self._result = await self.run() │ │ 369 │ │ except asyncio.CancelledError as error: │ │ 370 │ │ │ self.state = WorkerState.CANCELLED │ │ 371 │ │ │ self._error = error │ │ │ │ ╭────────────────────────────────────────────────────────────────────────── locals ──────────────────────────────────────────────────────────────────────────╮ │ │ │ app = Harlequin(title='Harlequin', classes={'-dark-mode'}) │ │ │ │ error = InternalException("INTERNAL Error: Attempted to access index 1 within vector of size 1\nThis error signals an assertion failure within │ │ │ │ DuckDB. This usually occurs due to unexpected conditions or errors in the program's logic.\nFor more information, see │ │ │ │ https://duckdb.org/docs/dev/internal_errors") │ │ │ │ self = │ │ │ │ Traceback = │ │ │ │ worker_failed = WorkerFailed('Worker raised exception: InternalException("INTERNAL Error: Attempted to access index 1 within vector of size 1\\nThis error │ │ │ │ signals an assertion failure within DuckDB. This usually occurs due to unexpected conditions or errors in the program\'s logic.\\nFor more │ │ │ │ information, see https://duckdb.org/docs/dev/internal_errors")') │ │ │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ │ │ │ │ /usr/local/lib/python3.12/site-packages/textual/worker.py:352 in run │ │ │ │ 349 │ │ Returns: │ │ 350 │ │ │ Return value of the work. │ │ 351 │ │ """ │ │ ❱ 352 │ │ return await ( │ │ 353 │ │ │ self._run_threaded() if self._thread_worker else self._run_async() │ │ 354 │ │ ) │ │ 355 │ │ │ │ ╭────────────────────────────────────────────────── locals ───────────────────────────────────────────────────╮ │ │ │ self = │ │ │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ │ │ │ │ /usr/local/lib/python3.12/site-packages/textual/worker.py:324 in _run_threaded │ │ │ │ 321 │ │ │ │ 322 │ │ loop = asyncio.get_running_loop() │ │ 323 │ │ assert loop is not None │ │ ❱ 324 │ │ return await loop.run_in_executor(None, runner, self._work) │ │ 325 │ │ │ 326 │ async def _run_async(self) -> ResultType: │ │ 327 │ │ """Run an async worker. │ │ │ │ ╭─────────────────────────────────────────────────────── locals ───────────────────────────────────────────────────────╮ │ │ │ loop = <_UnixSelectorEventLoop running=True closed=False debug=False> │ │ │ │ run_awaitable = .run_awaitable at 0xffff6adfbec0> │ │ │ │ run_callable = .run_callable at 0xffff6adfbc40> │ │ │ │ run_coroutine = .run_coroutine at 0xffff6adfbba0> │ │ │ │ runner = .run_callable at 0xffff6adfbc40> │ │ │ │ self = │ │ │ ╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ │ │ │ │ /usr/local/lib/python3.12/concurrent/futures/thread.py:58 in run │ │ │ │ 55 │ │ │ return ╭── locals ───╮ │ │ 56 │ │ │ self = None │ │ │ 57 │ │ try: ╰─────────────╯ │ │ ❱ 58 │ │ │ result = self.fn(*self.args, **self.kwargs) │ │ 59 │ │ except BaseException as exc: │ │ 60 │ │ │ self.future.set_exception(exc) │ │ 61 │ │ │ # Break a reference cycle with the exception 'exc' │ │ │ │ /usr/local/lib/python3.12/site-packages/textual/worker.py:307 in run_callable │ │ │ │ 304 │ │ def run_callable(work: Callable[[], ResultType]) -> ResultType: │ │ 305 │ │ │ """Set the active worker, and call the callable.""" │ │ 306 │ │ │ active_worker.set(self) │ │ ❱ 307 │ │ │ return work() │ │ 308 │ │ │ │ 309 │ │ if ( │ │ 310 │ │ │ inspect.iscoroutinefunction(self._work) │ │ │ │ ╭────────────────────────────────────────────────────────────────────────── locals ──────────────────────────────────────────────────────────────────────────╮ │ │ │ self = │ │ │ │ work = functools.partial(, Harlequin(title='Harlequin', classes={'-dark-mode'}), │ │ │ │ Catalog(items=[CatalogItem(qualified_identifier='"memory"', query_name='"memory"', label='memory', type_label='db', │ │ │ │ children=[CatalogItem(qualified_identifier='"memory"."main"', query_name='"memory"."main"', label='main', type_label='sch', children=[])])])) │ │ │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ │ │ │ │ /usr/local/lib/python3.12/site-packages/harlequin/app.py:1002 in update_completers │ │ │ │ 999 │ │ │ self.editor_collection.word_completer.update_catalog(catalog=catalog) │ │ 1000 │ │ │ self.editor_collection.member_completer.update_catalog(catalog=catalog) │ │ 1001 │ │ else: │ │ ❱ 1002 │ │ │ extra_completions = self.connection.get_completions() │ │ 1003 │ │ │ word_completer, member_completer = completer_factory( │ │ 1004 │ │ │ │ catalog=catalog, │ │ 1005 │ │ │ │ extra_completions=extra_completions, │ │ │ │ ╭────────────────────────────────────────────────────────────────────────── locals ──────────────────────────────────────────────────────────────────────────╮ │ │ │ catalog = Catalog( │ │ │ │ │ items=[ │ │ │ │ │ │ CatalogItem( │ │ │ │ │ │ │ qualified_identifier='"memory"', │ │ │ │ │ │ │ query_name='"memory"', │ │ │ │ │ │ │ label='memory', │ │ │ │ │ │ │ type_label='db', │ │ │ │ │ │ │ children=[ │ │ │ │ │ │ │ │ CatalogItem( │ │ │ │ │ │ │ │ │ qualified_identifier='"memory"."main"', │ │ │ │ │ │ │ │ │ query_name='"memory"."main"', │ │ │ │ │ │ │ │ │ label='main', │ │ │ │ │ │ │ │ │ type_label='sch', │ │ │ │ │ │ │ │ │ children=[] │ │ │ │ │ │ │ │ ) │ │ │ │ │ │ │ ] │ │ │ │ │ │ ) │ │ │ │ │ ] │ │ │ │ ) │ │ │ │ self = Harlequin(title='Harlequin', classes={'-dark-mode'}) │ │ │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ │ │ │ │ /usr/local/lib/python3.12/site-packages/harlequin_duckdb/adapter.py:188 in get_completions │ │ │ │ 185 │ │ │ │ priority=priority, │ │ 186 │ │ │ │ context=context, │ │ 187 │ │ │ ) │ │ ❱ 188 │ │ │ for label, type_label, priority, context in get_completion_data(cur) │ │ 189 │ │ ] │ │ 190 │ │ │ 191 │ def validate_sql(self, text: str) -> str: │ │ │ │ ╭────────────────────────────────── locals ───────────────────────────────────╮ │ │ │ cur = │ │ │ │ self = │ │ │ ╰─────────────────────────────────────────────────────────────────────────────╯ │ │ │ │ /usr/local/lib/python3.12/site-packages/harlequin_duckdb/completions.py:51 in get_completion_data │ │ │ │ 48 │ │ """ │ │ 49 │ ).fetchall() │ │ 50 │ │ │ ❱ 51 │ type_data = cur.execute( │ │ 52 │ │ """ │ │ 53 │ │ with │ │ 54 │ │ │ system_types as ( │ │ │ │ ╭─────────────────────────────────── locals ───────────────────────────────────╮ │ │ │ cur = │ │ │ │ function_data = [ │ │ │ │ │ ('pragma_metadata_info', 'fn->T', 1000, None), │ │ │ │ │ ('duckdb_indexes', 'fn->T', 1000, None), │ │ │ │ │ ('duckdb_optimizers', 'fn->T', 1000, None), │ │ │ │ │ ('duckdb_secrets', 'fn->T', 1000, None), │ │ │ │ │ ('duckdb_temporary_files', 'fn->T', 1000, None), │ │ │ │ │ ('duckdb_types', 'fn->T', 1000, None), │ │ │ │ │ ('duckdb_databases', 'fn->T', 1000, None), │ │ │ │ │ ('checkpoint', 'fn->T', 1000, None), │ │ │ │ │ ('tpcds_answers', 'fn->T', 1000, None), │ │ │ │ │ ('sniff_csv', 'fn->T', 1000, None), │ │ │ │ │ ... +980 │ │ │ │ ] │ │ │ │ keyword_data = [ │ │ │ │ │ ('all', 'kw', 100, None), │ │ │ │ │ ('always', 'kw', 1000, None), │ │ │ │ │ ('analyze', 'kw', 100, None), │ │ │ │ │ ('assignment', 'kw', 1000, None), │ │ │ │ │ ('asymmetric', 'kw', 100, None), │ │ │ │ │ ('authorization', 'kw', 1000, None), │ │ │ │ │ ('backward', 'kw', 1000, None), │ │ │ │ │ ('between', 'kw', 1000, None), │ │ │ │ │ ('call', 'kw', 1000, None), │ │ │ │ │ ('cast', 'kw', 100, None), │ │ │ │ │ ... +470 │ │ │ │ ] │ │ │ │ settings_data = [ │ │ │ │ │ ('enable_external_access', 'set', 2000, None), │ │ │ │ │ ('allow_unsigned_extensions', 'set', 2000, None), │ │ │ │ │ ('enable_progress_bar', 'set', 2000, None), │ │ │ │ │ ('force_bitpacking_mode', 'set', 2000, None), │ │ │ │ │ ('enable_macro_dependencies', 'set', 2000, None), │ │ │ │ │ ('max_expression_depth', 'set', 2000, None), │ │ │ │ │ ('nested_loop_join_threshold', 'set', 2000, None), │ │ │ │ │ ('pivot_limit', 'set', 2000, None), │ │ │ │ │ ('threads', 'set', 2000, None), │ │ │ │ │ ( │ │ │ │ │ │ 'partitioned_write_max_open_files', │ │ │ │ │ │ 'set', │ │ │ │ │ │ 2000, │ │ │ │ │ │ None │ │ │ │ │ ), │ │ │ │ │ ... +94 │ │ │ │ ] │ │ │ ╰──────────────────────────────────────────────────────────────────────────────╯ │ ╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ InternalException: INTERNAL Error: Attempted to access index 1 within vector of size 1 This error signals an assertion failure within DuckDB. This usually occurs due to unexpected conditions or errors in the program's logic. For more information, see https://duckdb.org/docs/dev/internal_errors Expected behavior The app should not crash ;) Actual behavior Contributing
Additional context What is the output of What database adapter are you using with Harlequin? (Default is What other options are you using when invoking Harlequin? (If you are using a profile, please add relevant items from your profile here). Can you tell us more about your system?
Tip For example, for my system, these are:
How did you install Harlequin?
|
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 3 replies
-
Seems related to |
Beta Was this translation helpful? Give feedback.
-
woof. thanks for the report. |
Beta Was this translation helpful? Give feedback.
-
Hey, this is on DuckDB side, it has since been fixed by this PR duckdb/duckdb#13873, will be in the upcoming v1.1.1. harlequin side the crash can be work-arounded by explicitly materializing with
+ system_types as materialized (
- system_types as (
select distinct
type_name as label,
'type' as type_label,
1000 as priority,
null as context
from duckdb_types()
where database_name = 'system'
),
custom_types as (
select distinct
type_name as label,
'type' as type_label,
1000 as priority,
schema_name as context
from duckdb_types()
where
database_name not in ('system', 'temp')
and type_name not in (select label from system_types)
)
select *
from system_types
union all
select *
from custom_types; Thanks |
Beta Was this translation helpful? Give feedback.
Hey, this is on DuckDB side, it has since been fixed by this PR duckdb/duckdb#13873, will be in the upcoming v1.1.1.
harlequin side the crash can be work-arounded by explicitly materializing
system_types
like: