Skip to content

v1.4.4 INTERNAL Error: Attempted to access index 5 within vector of size 5 #749

@tkovis

Description

@tkovis

What happens?

Using duckdb v1.4.4 with ducklake.

If a table is partitioned by an arbitrary key (type VARCHAR in this example) and also a partition function (year, month, day, hour) then updating the arbitrary key causes an internal error (see "To Reproduce").

To Reproduce

A file named minimal.sql

INSTALL ducklake;
SELECT VERSION(); -- v1.4.4
ATTACH 'ducklake:metadata.ducklake' AS my_ducklake;
USE my_ducklake;
CREATE TABLE t (p VARCHAR, ts TIMESTAMP, v VARCHAR);
ALTER TABLE t SET PARTITIONED BY (p, day(ts)); -- works with (p), (p, v) fails with partition function
INSERT INTO t VALUES ('p1', TIMESTAMP '2026-02-05', 'va');
SELECT 1; -- prints
UPDATE t SET p = 'p3' WHERE v = 'va'; -- error
SELECT 2; -- doesnt print
duckdb < minimal.sql
┌─────────────┐
│ "version"() │
│   varchar   │
├─────────────┤
│ v1.4.4      │
└─────────────┘
┌───────┐
│   1   │
│ int32 │
├───────┤
│   1   │
└───────┘
INTERNAL Error:
Attempted to access index 5 within vector of size 5

Stack Trace:

0        _ZN6duckdb9ExceptionC2ENS_13ExceptionTypeERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE + 64
1        _ZN6duckdb17InternalExceptionC1ERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE + 20
2        _ZN6duckdb17InternalExceptionC1IJyyEEERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEDpT_ + 136
3        _ZN6duckdb6vectorINS_19FunctionDescriptionELb1EEixEm + 136
4        _ZN6duckdb9DataChunk4HashERNS_6vectorIyLb1EEERNS_6VectorE + 108
5        _ZN6duckdb25HivePartitionedColumnData23ComputePartitionIndicesERNS_32PartitionedColumnDataAppendStateERNS_9DataChunkE + 60
6        _ZN6duckdb21PartitionedColumnData6AppendERNS_32PartitionedColumnDataAppendStateERNS_9DataChunkE + 44
7        _ZNK6duckdb18PhysicalCopyToFile4SinkERNS_16ExecutionContextERNS_9DataChunkERNS_17OperatorSinkInputE + 204
8        _ZNK6duckdb14DuckLakeUpdate4SinkERNS_16ExecutionContextERNS_9DataChunkERNS_17OperatorSinkInputE + 708
9        duckdb::PipelineExecutor::ExecutePushInternal(duckdb::DataChunk&, duckdb::ExecutionBudget&, unsigned long long) + 264
10       duckdb::PipelineExecutor::Execute(unsigned long long) + 360
11       duckdb::PipelineTask::ExecuteTask(duckdb::TaskExecutionMode) + 328
12       duckdb::ExecutorTask::Execute(duckdb::TaskExecutionMode) + 288
13       duckdb::TaskScheduler::ExecuteForever(std::__1::atomic<bool>*) + 612
14       void* std::__1::__thread_proxy[abi:ue170006]<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct>>, void (*)(duckdb::TaskScheduler*, std::__1::atomic<bool>*), duckdb::TaskScheduler*, std::__1::atomic<bool>*>>(void*) + 56
15       _pthread_start + 136
16       thread_start + 8

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/stable/dev/internal_errors
FATAL Error:
Failed: database has been invalidated because of a previous fatal error. The database must be restarted prior to being used again.
Original error: "Attempted to access index 5 within vector of size 5"

Stack Trace:

0        _ZN6duckdb9ExceptionC2ENS_13ExceptionTypeERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE + 64
1        _ZN6duckdb14FatalExceptionC1ENS_13ExceptionTypeERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE + 12
2        _ZN6duckdb12ErrorManager19InvalidatedDatabaseERNS_13ClientContextERKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEE + 104
3        _ZN6duckdb13ClientContext18BeginQueryInternalERNS_17ClientContextLockERKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEE + 916
4        _ZN6duckdb13ClientContext35PendingStatementOrPreparedStatementERNS_17ClientContextLockERKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEENS_10unique_ptrINS_12SQLStatementENS3_14default_deleteISD_EELb1EEERNS_10shared_ptrINS_21PreparedStatementDataELb1EEERKNS_22PendingQueryParametersE + 264
5        _ZN6duckdb13ClientContext43PendingStatementOrPreparedStatementInternalERNS_17ClientContextLockERKNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEENS_10unique_ptrINS_12SQLStatementENS3_14default_deleteISD_EELb1EEERNS_10shared_ptrINS_21PreparedStatementDataELb1EEERKNS_22PendingQueryParametersE + 1580
6        _ZN6duckdb13ClientContext20PendingQueryInternalERNS_17ClientContextLockENS_10unique_ptrINS_12SQLStatementENSt3__114default_deleteIS4_EELb1EEERKNS_22PendingQueryParametersEb + 132
7        _ZN6duckdb13ClientContext5QueryERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEb + 368
8        _ZN6duckdb10Connection8RollbackEv + 68
9        _ZN6duckdb19DuckLakeTransaction8RollbackEv + 36
10       _ZN6duckdb26DuckLakeTransactionManager19RollbackTransactionERNS_11TransactionE + 44
11       duckdb::MetaTransaction::Rollback() + 168
12       duckdb::TransactionContext::Rollback(duckdb::optional_ptr<duckdb::ErrorData, true>) + 96
13       duckdb::ClientContext::EndQueryInternal(duckdb::ClientContextLock&, bool, bool, duckdb::optional_ptr<duckdb::ErrorData, true>) + 360
14       duckdb::ClientContext::ExecuteTaskInternal(duckdb::ClientContextLock&, duckdb::BaseQueryResult&, bool) + 692
15       duckdb::PendingQueryResult::ExecuteInternal(duckdb::ClientContextLock&) + 120
16       duckdb::PendingQueryResult::Execute() + 56
17       duckdb_shell_sqlite3_print_duckbox + 520
18       duckdb_shell::ShellState::ExecutePreparedStatement(sqlite3_stmt*) + 588
19       duckdb_shell::ShellState::ExecuteSQL(char const*, char**) + 388
20       duckdb_shell::ShellState::RunOneSqlLine(duckdb_shell::InputMode, char*) + 256
21       duckdb_shell::ShellState::ProcessInput(duckdb_shell::InputMode) + 952
22       main + 3736
23       start + 7184


Stack Trace:

0        duckdb::Exception::Exception(duckdb::ExceptionType, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&) + 64
1        duckdb::FatalException::FatalException(duckdb::ExceptionType, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&) + 12
2        duckdb::ErrorManager::InvalidatedDatabase(duckdb::ClientContext&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&) + 172
3        duckdb::ClientContext::BeginQueryInternal(duckdb::ClientContextLock&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&) + 900
4        duckdb::ClientContext::PendingStatementOrPreparedStatement(duckdb::ClientContextLock&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&, duckdb::unique_ptr<duckdb::SQLStatement, std::__1::default_delete<duckdb::SQLStatement>, true>, duckdb::shared_ptr<duckdb::PreparedStatementData, true>&, duckdb::PendingQueryParameters const&) + 272
5        duckdb::ClientContext::PendingStatementOrPreparedStatementInternal(duckdb::ClientContextLock&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const&, duckdb::unique_ptr<duckdb::SQLStatement, std::__1::default_delete<duckdb::SQLStatement>, true>, duckdb::shared_ptr<duckdb::PreparedStatementData, true>&, duckdb::PendingQueryParameters const&) + 1476
6        duckdb::ClientContext::PendingQueryInternal(duckdb::ClientContextLock&, duckdb::unique_ptr<duckdb::SQLStatement, std::__1::default_delete<duckdb::SQLStatement>, true>, duckdb::PendingQueryParameters const&, bool) + 144
7        duckdb::ClientContext::PendingQuery(duckdb::unique_ptr<duckdb::SQLStatement, std::__1::default_delete<duckdb::SQLStatement>, true>, std::__1::unordered_map<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, duckdb::BoundParameterData, duckdb::CaseInsensitiveStringHashFunction, duckdb::CaseInsensitiveStringEquality, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>> const, duckdb::BoundParameterData>>>&, bool) + 288
8        duckdb::ClientContext::PendingQuery(duckdb::unique_ptr<duckdb::SQLStatement, std::__1::default_delete<duckdb::SQLStatement>, true>, bool) + 64
9        duckdb::Connection::PendingQuery(duckdb::unique_ptr<duckdb::SQLStatement, std::__1::default_delete<duckdb::SQLStatement>, true>, bool) + 64
10       duckdb_shell_sqlite3_prepare_v2 + 996
11       duckdb_shell::ShellState::ExecuteSQL(char const*, char**) + 108
12       duckdb_shell::ShellState::RunOneSqlLine(duckdb_shell::InputMode, char*) + 256
13       duckdb_shell::ShellState::ProcessInput(duckdb_shell::InputMode) + 952
14       main + 3736
15       start + 7184

OS:

macos ARM

DuckDB Version:

1.4.4

DuckLake Version:

unsure how to check, but the built in one?

DuckDB Client:

cli, but also happens with nodejs neo

Hardware:

No response

Full Name:

Tuomas Koivistoinen

Affiliation:

Tuumo Oy

What is the latest build you tested with? If possible, we recommend testing with the latest nightly build.

I have tested with a stable release

Did you include all relevant data sets for reproducing the issue?

Yes

Did you include all code required to reproduce the issue?

  • Yes, I have

Did you include all relevant configuration (e.g., CPU architecture, Python version, Linux distribution) to reproduce the issue?

  • Yes, I have

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions