IPFS CID links returning unknown node type error when accessing uploaded files

I’m having trouble accessing files I uploaded to NFT Storage through IPFS. The files appear correctly in my storage dashboard, but when I try to access them using the CID links, I get an error message saying ipfs cat /ipfs/bafyreiayui2us6fpowl42vqwmjrntpewhqpfkbgcak6pt4gkpz55z2o3se/: unknown node type.

Here’s the code I’m using to upload:

const { NFTStorage, File } = require('nft.storage')
const token = 'eyJ........CJ9'
const storage = new NFTStorage({ token: token })

const result = await storage.store({
   name: itemName,
   description: itemDescription,
   creatorName: creatorName,
   image: new File(fileData, uploadFileName, { type: uploadFile.mimetype }),
})
console.log(result.url)

Both the metadata and the actual file show up in my NFT Storage interface, so the upload seems successful. I suspect this might be related to the file size, but I’m not sure how to fix it. Has anyone encountered this issue before?

yeah, same thing happened to me! ipfs cat only works for files, not directories. since nft.storage creates a folder, run ipfs ls first to see what’s inside that cid. then grab the specific file you want!

This happens when you’re trying to access a directory CID instead of a specific file. Your CID points to the root directory of your NFT metadata, not the actual file you want. NFT Storage creates a directory structure with your metadata.json and image file. You need to add the filename to your CID path. Try ipfs cat /ipfs/bafyreiayui2us6fpowl42vqwmjrntpewhqpfkbgcak6pt4gkpz55z2o3se/your-filename.jpg instead. Or run ipfs ls on that CID first to see what’s in the directory and find the right file path. I’ve hit this same issue before - you just need to drill down to the specific file instead of trying to cat the whole directory.

Hmm, interesting - are you trying to access the image file directly or just browsing the metadata? What exactly are you expecting to see when you run that ipfs cat command?

I’ve noticed this error sometimes happens because the CID you’re using points to the whole NFT package (metadata + image) rather than just the file itself. When you log result.url in your code, what does that URL look like? Does it end with just the CID or have additional path info?

You mentioned suspecting file size might be an issue - how big are the files you’re uploading? I’m wondering if there’s some chunking happening that’s affecting how the data gets stored. Have you tried with a really small test file to see if the same thing happens?