metaplex-foundation / metaplex

A directory of what the Metaplex Foundation works on!
https://metaplex.com
Apache License 2.0
3.32k stars 6.26k forks source link

RangeError: encoding overruns Buffer #919

Closed JustOneMorePrint closed 2 years ago

JustOneMorePrint commented 2 years ago

Hey everyone,

as for some people before me, the upload doesn't work as it should be for me, too.

I ran: (newest CLI) ts-node /Users/xxx/Documents/Workspaces/metaplex/js/packages/cli/src/candy-machine-cli.ts upload . --env mainnet-beta --keypair ~/.config/solana/xxx.json

Writing indices 2120-2129 saving config line 3110-3119 failed RangeError: encoding overruns Buffer at Blob.encode (/Users/xxx/Documents/Workspaces/metaplex/js/node_modules/buffer-layout/lib/Layout.js:2334:13) at Structure.encode (/Users/xxx/Documents/Workspaces/metaplex/js/node_modules/buffer-layout/lib/Layout.js:1272:26) at WrappedLayout.encode (/Users/xxx/Documents/Workspaces/metaplex/js/node_modules/@project-serum/borsh/src/index.ts:96:24) at WrappedLayout.encode (/Users/xxx/Documents/Workspaces/metaplex/js/node_modules/@project-serum/borsh/src/index.ts:96:24) at Structure.encode (/Users/xxx/Documents/Workspaces/metaplex/js/node_modules/buffer-layout/lib/Layout.js:1272:26) at /Users/xxx/Documents/Workspaces/metaplex/js/node_modules/buffer-layout/lib/Layout.js:1117:25 at Array.reduce () at Sequence.encode (/Users/xxx/Documents/Workspaces/metaplex/js/node_modules/buffer-layout/lib/Layout.js:1116:22) at Structure.encode (/Users/xxx/Documents/Workspaces/metaplex/js/node_modules/buffer-layout/lib/Layout.js:1272:26) at WrappedLayout.encode (/Users/xxx/Documents/Workspaces/metaplex/js/node_modules/@project-serum/borsh/src/index.ts:96:24) Writing indices 3120-3129 saving config line 1120-1129 failed RangeError: encoding overruns Buffer at Blob.encode (/Users/xxx/Documents/Workspaces/metaplex/js/node_modules/buffer-layout/lib/Layout.js:2334:13) at Structure.encode (/Users/xxx/Documents/Workspaces/metaplex/js/node_modules/buffer-layout/lib/Layout.js:1272:26) at WrappedLayout.encode (/Users/xxx/Documents/Workspaces/metaplex/js/node_modules/@project-serum/borsh/src/index.ts:96:24) at WrappedLayout.encode (/Users/xxx/Documents/Workspaces/metaplex/js/node_modules/@project-serum/borsh/src/index.ts:96:24) at Structure.encode (/Users/xxx/Documents/Workspaces/metaplex/js/node_modules/buffer-layout/lib/Layout.js:1272:26) at /Users/xxx/Documents/Workspaces/metaplex/js/node_modules/buffer-layout/lib/Layout.js:1117:25 at Array.reduce () at Sequence.encode (/Users/xxx/Documents/Workspaces/metaplex/js/node_modules/buffer-layout/lib/Layout.js:1116:22) at Structure.encode (/Users/xxx/Documents/Workspaces/metaplex/js/node_modules/buffer-layout/lib/Layout.js:1272:26) at WrappedLayout.encode (/Users/xxx/Documents/Workspaces/metaplex/js/node_modules/@project-serum/borsh/src/index.ts:96:24) Writing indices 1130-1139 saving config line 2120-2129 failed RangeError: encoding overruns Buffer

and so on ....

The first 1001 NFTs uploaded (onChain = true in .cache) and some others in the 3xxx range. In total I have 1007 NFTs of more than 2000 uploaded and the rest failed. The name of every NFT is less than 30 digits and obviously these above 1000 wouldn't have been uploaded if that was the issue. Rerunning or letting the cli run for a longer time doesn't help either.

I hope you can help me

KR

JustOneMorePrint commented 2 years ago

seems like changing one line helps: metaplex/js/packages/cli/src/commands/upload.ts (line: 176):

from: const indexes = allIndexesInSlice.slice(offset, offset + 10); to: const indexes = allIndexesInSlice.slice(offset, offset + 5);

I would like to help you investigating why this happened (if you are interested). Please just tell me what you need to know.

System is an Intel Mac btw.

JustOneMorePrint commented 2 years ago

hasn't been fixed by that :/ It tells upload successful but some NFTs are still onChain false

EDIT: has been a long night. forgot to change offset += 5 on line 174

Kameeno commented 2 years ago

lol same here, to fix it i had to do a ugly workaround, allIndexesInSlice.length returned to me 1000 instead of 1100 (i had 1100 nft's to upload)

and at the line of async allIndexesInSlice => { there's a for loop i replaced with: for ( let offset = 0; offset < keys.length; offset += 1 ) and const indexes = allIndexesInSlice.slice(offset, offset + 1);

it looks terribly slow like this, i hope it works

DigitalLabsart commented 2 years ago

lol same here, to fix it i had to do a ugly workaround, allIndexesInSlice.length returned to me 1000 instead of 1100 (i had 1100 nft's to upload)

and at the line of async allIndexesInSlice => { there's a for loop i replaced with: for ( let offset = 0; offset < keys.length; offset += 1 ) and const indexes = allIndexesInSlice.slice(offset, offset + 1);

it looks terribly slow like this, i hope it works

how did u fix it

summerplaybook commented 2 years ago

any solutions to this?

khaIilnafis commented 2 years ago

The issue here is with the name of the NFT exceeding the bytes allotted for that field. @bhgames helped me debug this for a collection.

Can't recall all the details but I shortened the name of my collection to bypass.

slimmsyd commented 2 years ago

The issue here is with the name of the NFT exceeding the bytes allotted for that field. @bhgames helped me debug this for a collection.

Can't recall all the details but I shortened the name of my collection to bypass.

You have time to look at my devnet collection to see where I'm going wrong? Would love the help if you can thank you.

khatriamit commented 2 years ago

The issue here is with the name of the NFT exceeding the bytes allotted for that field. @bhgames helped me debug this for a collection.

Can't recall all the details but I shortened the name of my collection to bypass.

I was facing the same issue and this worked for me too. Thanks a lot.