extension-template icon indicating copy to clipboard operation
extension-template copied to clipboard

Metadata incompatible error when loading extension

Open freddie-freeloader opened this issue 1 year ago • 5 comments

I compiled the project with make and it successfully created the DuckDB CLI and a loadable extension <extension-name>.duckdb_extension.

Now I downloaded the latest DuckDB CLI binary from https://github.com/duckdb/duckdb/releases/download/v0.10.2/duckdb_cli-linux-amd64.zip and tried to load the extension file with install '<path-to-extension>/<extension-name>.duckdb_extension'; + load <extension-name>;, I get:

Invalid Input Error: Extension "<home-dir>/.duckdb/extensions/v0.10.2/linux_amd64_gcc4/<extension_name>.duckdb_extension" 
do not have metadata compatible with DuckDB loading it (version v0.10.2, platform linux_amd64_gcc4)

I checked the version of the binary, and it's v0.10.2 1601d94f94 & I compiled my extension against the same version of DuckDB.

What am I doing wrong? :thinking:

freddie-freeloader avatar May 11 '24 09:05 freddie-freeloader

Hey @freddie-freeloader I think you may have an old version of the extension installed, can you try FORCE INSTALL '<path-to-extension>/<extension-name>.duckdb_extension'; ?

running install with an already installed extension of that name is a NOP

samansmink avatar May 13 '24 07:05 samansmink

Thank you @samansmink, that helped.

Now, I get the following error:

Invalid Input Error: Extension "<home-dir>/.duckdb/extensions/v0.10.2/linux_amd64_gcc4/<extension-name>.duckdb_extension" 
(version v0.10.2, platfrom linux_amd64) does not match DuckDB loading it (version v0.10.2, platform linux_amd64_gcc4)

I guess the issue is, that my extension is linux_amd64 and expected is linux_amd64_gcc4.

So I added -DCMAKE_C_COMPILER=/usr/bin/gcc -DCMAKE_CXX_COMPILER=/usr/bin/g++ to the appropriate CMAKE invocations in extension-ci-tools/makefiles/duckdb_extension.Makefile to compile with gcc & g++. But I still get the above error.

Any ideas, what the problem might be?

freddie-freeloader avatar May 18 '24 14:05 freddie-freeloader

Now, I set up the S3-Bucket workflow, and have it build the extension + push to S3-Bucket.

My repository is: https://github.com/freddie-freeloader/duckdb-extension-test

When I run

D SET custom_extension_repository = 'http://duckdb-sheetreader-extension.s3.eu-central-1.amazonaws.com';
D force install sheetreader;
D load sheetreader;

I get

Invalid Input Error: Extension "/home/jub/.duckdb/extensions/v0.10.2/linux_amd64_gcc4/sheetreader.duckdb_extension" 
do not have metadata compatible with DuckDB loading it 
(version v0.10.2, platform linux_amd64_gcc4)

As you can see in my repository, I use 1601d94f94a7e0d2eb805a94803eb1e3afbbe4ed of the duckdb repository -- so it's unclear to me, what causes the metadata to be incompatible.

freddie-freeloader avatar May 20 '24 13:05 freddie-freeloader

My current workaround is to truncate the last 256 byte, that contain the metadata AFAIK (https://github.com/duckdb/duckdb/pull/11515):

truncate -s -256 sheetreader.duckdb_extension

freddie-freeloader avatar May 25 '24 09:05 freddie-freeloader

Hey @samansmink ,

I now updated my repository (https://github.com/freddie-freeloader/duckdb-extension-test) to use duckdb 1.0 and the appropriate extension-ci-tools.

When I do

D SET custom_extension_repository = 'http://duckdb-sheetreader-extension.s3.eu-central-1.amazonaws.com';
D FORCE INSTALL sheetreader;

I now get

IO Error: Failed to install 'sheetreader'
The file is not a DuckDB extension. The metadata at the end of the file is invalid

I tried ExtensionHelper::ParseExtensionMetaData and there indeed seems to be a problem with the metadata -- it seems to be misaligned:

parsed_metadata:
  magic_value:"ature\200\004\070\071\063\071\062\061\071v1.0.0linux_amd644"
  platform: "\000\000\001", '\000' <repeats 15 times>, "\223\004\020duckdb_sign"
  ...

Do you have any pointers, when/where the metadata is written and how I could debug the problem?

freddie-freeloader avatar Jun 11 '24 16:06 freddie-freeloader