// DuckDB error reference

Serialization Error: The database file version is incompatible

DuckDB could not serialize data for a COPY, export or checkpoint, or a database file was written by an incompatible version.

Exception
Serialization Error
카테고리
Extension and feature errors
오류 메시지
Serialization Error: Loading a database file written by a different DuckDB version is not supported

의미

DuckDB database files record the storage version they were written with. A file written by a newer DuckDB cannot be opened by an older build. Since v0.10 the format is backwards compatible, so a current build reads files from older versions, but never the other way around.

The wording has changed across versions. Older builds print the classic Serialization Error: Loading a database file written by a different DuckDB version is not supported. DuckDB 2.x reports storage version numbers instead, for example IO Error: Trying to read a database file with version number 69, but we can only read versions between 64 and 68. A newer-feature file reports Serialization Error: Failed to deserialize: .... All of them mean the same mismatch between the build that wrote the file and the build that opened it.

일반적인 원인

  • An app or driver pinned to an older DuckDB opened a file that a newer tool, CLI or notebook wrote.
  • Two machines, or a laptop and a container, share one file while running different DuckDB versions.
  • A CI run wrote the file with the latest build and a deployment with an older library picked it up.

Find the cause

-- Run on both the connection that fails and the one that wrote the file:
SELECT version();
-- What storage version this build checkpoints as (DuckDB 2.x):
SELECT current_setting('storage_compatibility_version') AS written_as;

해결 방법

  1. Check the version of the build that fails, then upgrade it to at least the version that wrote the file:

    SELECT version();
  2. When both versions must stay, copy the data out with the newer build and load it with the older one:

    COPY my_table TO 'my_table.parquet' (FORMAT PARQUET);
  3. To keep sharing a file with older readers, a recent DuckDB can checkpoint against an older storage version:

    ATTACH 'compat.duckdb' (STORAGE_VERSION 'v1.4.0');

Other ways to handle it

Parquet and CSV are the interchange formats between incompatible builds, and DuckDB reads both on every version. For teams that must share database files, agree on the oldest DuckDB version in play and pin everyone to it, or keep the shared data in files rather than in a database file.

안전하게 재현하세요

-- Not reproducible inside one build: the mismatch happens when the file is opened.
-- Check both sides of the handoff first:
SELECT version();

질문

Can a newer DuckDB open a file from an older version?

Yes. Since v0.10 the storage format is backwards compatible, so current builds read files written by older versions.

How do I move a database to a machine that cannot be upgraded?

Export with the newer build as Parquet or CSV and load it there, or have the newer build write the file with an older storage version using ATTACH ... (STORAGE_VERSION ...).

관련 오류

코드와 메시지 텍스트의 출처는 다음과 같습니다 DuckDB documentation. 전체 목록은 DuckDB error list 또는 모든 데이터베이스 오류 검색.

// 오류는 줄이고, 수정은 빠르게

Work on DuckDB in SQLly

A native SQL client for macOS, Windows and Linux with schema-aware IntelliSense, guardrails for risky statements and clear error messages, for DuckDB and the other databases you use.

이 페이지의 텍스트와 데이터: CC BY 4.0, 출처: SQLly (sqlly.app). 코드와 SQL 스니펫: MIT. 라이선스 세부 정보 인용된 오류 메시지 텍스트의 권리는 해당 데이터베이스 공급업체에 있습니다.