Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ipfs get $hashofblock gives confusing error message #2807

Closed
jonnor opened this issue Jun 5, 2016 · 12 comments · Fixed by #2886
Closed

ipfs get $hashofblock gives confusing error message #2807

jonnor opened this issue Jun 5, 2016 · 12 comments · Fixed by #2886
Assignees
Labels
exp/novice Someone with a little familiarity can pick up kind/enhancement A net-new feature or improvement to an existing feature topic/docs-ipfs Topic docs-ipfs

Comments

@jonnor
Copy link

jonnor commented Jun 5, 2016

When the hash referred is a block, one cannot use ipfs get (as it expects a file object) - but instead have to use ipfs block get. This is fine, but the error message when attempting is not very helpful in understanding this:

$ ipfs get QmSnWHYwDUE1gdcUb6ZYgU2khZ5FkxuWsTvXbw3zGsKc3x
Error: Failed to decode Protocol Buffers: incorrectly formatted merkledag node: Unmarshal failed. proto: illegal wireType 6

$ ipfs block get QmSnWHYwDUE1gdcUb6ZYgU2khZ5FkxuWsTvXbw3zGsKc3x
�ripld-image-version�htilesize�ax��ay��etiles�ax�ay�flevel0��fformatcpngdsize�ax��ay��ddata���
......

Expected would be something like "Requested hash $hash refers to a block, not an object. Use ipfs block get instead". Possibly with the detailed error message above following it.

Ping @Kubuxu

@Kubuxu Kubuxu added kind/enhancement A net-new feature or improvement to an existing feature topic/docs-ipfs Topic docs-ipfs exp/novice Someone with a little familiarity can pick up labels Jun 5, 2016
@Kubuxu
Copy link
Member

Kubuxu commented Jun 5, 2016

All files are blocks, in this case the block just doesn't contain unixfs format.

It should be more of: "Requested hash isn't recognised unix file encoding format" or something similar.
If someone has good error message, it should be quite easy to implement.

@whyrusleeping
Copy link
Member

It looks like the block you requested is not a merkledag object. We should fix the error messages, and increase documentation around the layers of data involved here. raw blocks, merkledag protobufs, and then unixfs protobufs

@jonnor
Copy link
Author

jonnor commented Jun 6, 2016

It is the kind of "block" one gets with ipfs.block.put using HTTP API. I guess that is a "raw block"?
Some guidance around this when making use of the API would indeed have been helpful, it is quite possible I should not have been using the block method/endpoint in the first place...
Was uploading a Buffer representing a PNG in one case, and a CBOR serialized JSON in another case.

@Kubuxu Kubuxu self-assigned this Jun 21, 2016
@Kubuxu Kubuxu added this to the Ipfs 0.4.3 milestone Jun 21, 2016
@Kubuxu Kubuxu removed their assignment Jun 21, 2016
@whyrusleeping whyrusleeping self-assigned this Jun 21, 2016
@whyrusleeping
Copy link
Member

@jonnor would the following look good to you?

➜  go-ipfs git:(master) ✗ ipfs object get QmUJPTFZnR2CPGAzmfdYPghgrFtYFB6pf1BqMvqfiPDam8
Error: QmUJPTFZnR2CPGAzmfdYPghgrFtYFB6pf1BqMvqfiPDam8 was not a valid merkledag node

@jonnor
Copy link
Author

jonnor commented Jun 22, 2016

Not a merkledag node does not explain to me that it is a block, or help me understand that I should be using block...

@whyrusleeping
Copy link
Member

@jonnor well, everything is technically a block. The cause of the error is that its not a merkledag node. You can do a block get on a perfectly valid merkledag

@RichardLitt
Copy link
Member

If everything is a block, then why isn't ipfs block named ipfs merkledagNode?

@Kubuxu
Copy link
Member

Kubuxu commented Jun 22, 2016

@RichardLitt because ipfs block deals with raw blobs stored in IPFS. ipfs object deals with DAG nodes and ipfs get interprets DAG nodes as files.

@RichardLitt
Copy link
Member

ipfs block - Manipulate raw IPFS blocks.

Should this be 'raw IPFS MerkleDag blocks`, maybe?

@Kubuxu
Copy link
Member

Kubuxu commented Jun 22, 2016

No ipfs object manipulates MerkleDags. ipfs block is for binary data not interpreted by IPFS in any way.

@Kubuxu
Copy link
Member

Kubuxu commented Jun 22, 2016

All files built from objects, and all objects built from blocks.

@whyrusleeping
Copy link
Member

whyrusleeping commented Jun 22, 2016

@jonnor how about "The block referred to by was not a valid merkledag node" ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
exp/novice Someone with a little familiarity can pick up kind/enhancement A net-new feature or improvement to an existing feature topic/docs-ipfs Topic docs-ipfs
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants