pingcap / pingcap/tidb

LOAD DATA still panics with runtime error: index out of range [0] with length 0 when missing field is loaded into VECTOR NOT NULL column

Open
#67,533 6 comments 0 reactions 0 assignees View on GitHub
affects-8.5 component/executor impact/panic severity/major sig/execution type/bug
Dominant language
Go
Stars
40.5k
Forks
6.2k
PR merge metrics
PR metrics pending

Description

## Bug Report

Please answer these questions before submitting your issue. Thanks!

### 1. Minimal reproduce step (Required)

Related issues:
- #65585
- #67148

Current nightly already contains the fix from #65597 (`16df0d15bb0f1b20402891ee5d95cf178253e1bb`).
The reproduced nightly commit is `8a45fc4c16565ed0712f94b5ca2e7a219bfb80d4`, which is ahead of `16df0d15bb0f1b20402891ee5d95cf178253e1bb`.

```sh
printf '1\n' > /tmp/vector-missing-col.csv
mysql -u root -h 127.0.0.1 -P 45000 --local-infile=1
```

```sql
set @@sql_mode='';
drop database if exists repro_vector_load_data;
create database repro_vector_load_data;
use repro_vector_load_data;
create table t (id bigint primary key, v vector(3) not null);
load data local infile '/tmp/vector-missing-col.csv' into table t fields terminated by ',';
```

### 2. What did you expect to see? (Required)

No panic.

TiDB should return a user-facing validation error for the bad row, for example the original row materialization error:

```
VECTOR column 'v' cannot be null
```

or another non-panic error/warning path, but it should not crash in `batch_checker`.

### 3. What did you see instead (Required)

Client side:

```
ERROR 1105 (HY000): runtime error: index out of range [0] with length 0
```

TiDB log shows the original row-construction error first, then the panic:

```text
[ERROR] [load_data.go] ["failed to get row"] [error="VECTOR column 'v' cannot be null"]
[ERROR] [load_data.go] ["commitWork panicked"] [r="runtime error: index out of range [0] with length 0"]
```

Stack excerpt:

```text
github.com/pingcap/tidb/pkg/executor.getKeysNeedCheckOneRow
.../pkg/executor/batch_checker.go:125
github.com/pingcap/tidb/pkg/executor.getKeysNeedCheck
.../pkg/executor/batch_checker.go:89
github.com/pingcap/tidb/pkg/executor.(*InsertValues).batchCheckAndInsert
.../pkg/executor/insert_common.go:1208
```

This looks like the same `nil row -> batch checker panic` bug class as #65585 / #67148, but triggered by a different hard error from `getRow()`.

### 4. What is your TiDB version? (Required)

```text
Release Version: v26.3.0-alpha-2-g8a45fc4c16
Edition: Community
Git Commit Hash: 8a45fc4c16565ed0712f94b5ca2e7a219bfb80d4
Git Branch: HEAD
UTC Build Time: 2026-04-02 05:32:08
GoVersion: go1.25.8
Race Enabled: false
Check Table Before Drop: false
Store: tikv
Kernel Type: Classic
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.