metaplex-foundation / metaplex

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

Updating candy machine not working when modifying "number" after upload #1373

Closed shoevan closed 2 years ago

shoevan commented 2 years ago

Describe the bug I have uploaded x amount of NFT's whereas the number in the candy machine v2 config is x+1. After uploading I'm trying to update the number from x+1 to x, but on using the update_candy_machine command on candy_machine_v2 it responds with:

ProgramError: 313: Cannot change number of lines unless is a hidden config at Function.parse (metaplex/js/packages/cli/node_modules/@project-serum/anchor/src/error.ts:35:14) at Object.rpc [as updateCandyMachine] (metaplex/js/packages/cli/node_modules/@project-serum/anchor/src/program/namespace/rpc.ts:23:42) at processTicksAndRejections (node:internal/process/task_queues:96:5) at async Command. (metaplex/js/packages/cli/src/candy-machine-v2-cli.ts:671:16) { code: 313, msg: 'Cannot change number of lines unless is a hidden config' }

Is there no way to update the number at this point?

To Reproduce Steps to reproduce the behavior:

  1. In the candy machine config specify x+1 as the "number" (e.g. 11)
  2. Use candy_machine_v2 to upload x NFT's (e.g 10)
  3. Once uploaded, try update_candy_machine with the candy machine config "number" updated from x+1 to x
  4. See error

Expected behavior Should be able to update the number of NFT's in the candy machine

imdanielsp commented 2 years ago

@shoevan

I just tried this and after looking at the update_candy_machine instruction, it looks like it is implicitly supposed to do this; see https://github.com/metaplex-foundation/metaplex/blob/master/rust/nft-candy-machine-v2/src/lib.rs#L396.

That said, this will be closed as "by design". That said, I wonder if I can deploy my own version of this program, but I am too new to Solana to say that :) I will experiment in the dev net and let you know.

P.D. to be clear, I am not a member of the Metaplex Foundation, I am just a random dev that had the same issue :)

imdanielsp commented 2 years ago

FWIW, it looks like it is new in v2, see v1 instruction: https://github.com/metaplex-foundation/metaplex/blob/master/rust/nft-candy-machine/src/lib.rs#L217

github-actions[bot] commented 2 years ago

This Issue has received no activity for 30 days. We will close it in 2 days, please reopen if you are still experiencing this issue.

github-actions[bot] commented 2 years ago

This Issue has received no activity for 30 days. We will close it in 2 days, please reopen if you are still experiencing this issue.

DoubleHelixX commented 2 years ago

please reopen this - this is still a easy bug that many devs can fall into.

I am also having this exact issue. Tho in my case I am trying to update the hidden settings from being "null" to the format of how it would be when it is on.

off:
"hiddenSettings": null

on:

    "hiddenSettings": {
        "name":"My Collection",
        "uri":"https://ipfs.io/ipfs/QmdsJa5Qn62BXUFeqxJ6xxG***************/hidden_1.json",
        "hash":"b00fbb17c***********265e9357adf57376f2d574"
    },

Here are some interesting error logs:

wallet public key: ****************************
(node:28668) ExperimentalWarning: stream/web is an experimental feature. This feature could change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
(node:28668) ExperimentalWarning: buffer.Blob is an experimental feature. This feature could change at any time      
Transaction simulation failed: Error processing Instruction 0: custom program error: 0x1789 

then later down: ProgramError: 6025: Cannot Switch to Hidden Settings after items available is greater than 0

lefeverela commented 2 years ago

I am also interested for a solution

luiseduardoenriquez commented 2 years ago

that problem The same problem here, it happened to me in the following way, in the configuration json, I had specified the number (the number of NFT that was going to upload wrong.) I had placed 20 when it was really 10, all this in the devnet,

then I came to realize, after having run the "upload" command, So just when I was going to give the "update_candy_machine" command, I got that error and now I'm blocked because I don't know what to do

this was my json config { "price": 0.1, "number": 20, "gatekeeper": null, "solTreasuryAccount": "G3zRcUSxewte2CPtpiJ3c3kKiPKKW5qAWYz9A6kpqVdt", "splTokenAccount": null, "splToken": null, "goLiveDate": "05 May 2022 00:00:00 GMT", "endSettings": null, "whitelistMintSettings": null, "hiddenSettings": null, "storage": "arweave", "ipfsInfuraProjectId": null, "ipfsInfuraSecret": null, "awsS3Bucket": null, "noRetainAuthority": false, "unmutable": false }

and I wanted to fix it by changing the number { "price": 0.1, "number": 20, "gatekeeper": null, "solTreasuryAccount": "G3zRcUSxewte2CPtpiJ3c3kKiPKKW5qAWYz9A6kpqVdt", "splTokenAccount": null, "splToken": null, "goLiveDate": "05 May 2022 00:00:00 GMT", "endSettings": null, "whitelistMintSettings": null, "hiddenSettings": null, "storage": "arweave", "ipfsInfuraProjectId": null, "ipfsInfuraSecret": null, "awsS3Bucket": null, "noRetainAuthority": false, "unmutable": false }

this threw me log: [ 'Program cndy3Z4yapfJBmL3ShUp5exZKqR3z33thTzeNMm2gRZ invoke [1]', 'Program log: Instruction: UpdateCandyMachine', 'Program log: Custom program error: 0x177d', 'Program cndy3Z4yapfJBmL3ShUp5exZKqR3z33thTzeNMm2gRZ consumed 8902 of 1400000 compute units', 'Program cndy3Z4yapfJBmL3ShUp5exZKqR3z33thTzeNMm2gRZ failed: custom program error: 0x177d' ]

and i tried again and

{ code: 6013, msg: 'Cannot change number of lines unless is a hidden config' }

snehendu098 commented 2 years ago

Did any of you get any solution for this??

snehendu098 commented 2 years ago

please reopen this - this is still a easy bug that many devs can fall into.

I am also having this exact issue. Tho in my case I am trying to update the hidden settings from being "null" to the format of how it would be when it is on.

off: "hiddenSettings": null

on:

    "hiddenSettings": {
        "name":"My Collection",
        "uri":"https://ipfs.io/ipfs/QmdsJa5Qn62BXUFeqxJ6xxG***************/hidden_1.json",
        "hash":"b00fbb17c***********265e9357adf57376f2d574"
    },

Here are some interesting error logs:

wallet public key: ****************************
(node:28668) ExperimentalWarning: stream/web is an experimental feature. This feature could change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
(node:28668) ExperimentalWarning: buffer.Blob is an experimental feature. This feature could change at any time      
Transaction simulation failed: Error processing Instruction 0: custom program error: 0x1789 

then later down: ProgramError: 6025: Cannot Switch to Hidden Settings after items available is greater than 0

In the uri of hiddenSettings, does the given uri contains the metadata of all the nfts?

versvtile commented 2 years ago

Need a solution on this

mnedelko commented 2 years ago

Encountered the same problem. would be great if someone could please look into this. The URL provided y @imdanielsp above (thank you), which I believe may have been included to contextualize why this behavior was implicitly intended, leads to a 404 github page. Any advice on how this issue can be resolved would be highly appreciated.

Specifically, I am experiencing the issue that was mentioned above by @shoevan .

I increased "number" from 10 to 100.

{ "price": 0.1, "number": 100, "gatekeeper": null, "creators": [ { "address": "...", "share": 100 } ], "solTreasuryAccount": null, "splTokenAccount": null, "splToken": null, "goLiveDate": "...", "endSettings": null, "whitelistMintSettings": { "mode": "burnEveryTime", "mint": "...", "presale": true, "discountPrice": 0.05 }, "hiddenSettings": null, "uploadMethod": "bundlr", "retainAuthority": true, "isMutable": true, "symbol": "...", "sellerFeeBasisPoints": 500, "awsS3Bucket": null, "nftStorageAuthToken": null, "shdwStorageAccount": null }

This is the error I encountered:

Error running command (re-run needed): Candy Machine Error: CannotChangeNumberOfLines: Cannot change number of lines unless is a hidden config

mnedelko commented 2 years ago

I am embarrassed to admit it, but I believe I know where the error originates.

When configuring the candy machine, the number of assets ought to match the "number" property in the config.json. Incrementing the number property would require more assets to be included in the assets folder. Augmenting the number of assets required uploading more assets which I don't believe is included on the candy machine.

It appears that the only way to address this is to withdraw and deploy again?