{"record":{"id":"32a0f5d1d1a4c1ef","repo":"ipfs/kubo","slug":"s","errorCode":null,"errorMessage":"%s","messagePattern":"%s","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/commands/cid.go","lineNumber":539,"sourceCode":"\n\t\t// CIDv1: use base36 for libp2p-key, base32 for everything else\n\t\tv1 := cid.NewCidV1(c.Type(), c.Hash())\n\t\tv1Base := mbase.Encoding(mbase.Base32)\n\t\tif c.Type() == uint64(mc.Libp2pKey) {\n\t\t\tv1Base = mbase.Base36\n\t\t}\n\t\tv1Str, err := v1.StringOfBase(v1Base)\n\t\tif err != nil {\n\t\t\tv1Str = v1.String()\n\t\t}\n\t\tres.CidV1 = v1Str\n\n\t\treturn cmds.EmitOnce(resp, res)\n\t},\n\tEncoders: cmds.EncoderMap{\n\t\tcmds.Text: cmds.MakeTypedEncoder(func(req *cmds.Request, w io.Writer, res *CidInspectRes) error {\n\t\t\tif res.ErrorMsg != \"\" {\n\t\t\t\treturn fmt.Errorf(\"%s\", res.ErrorMsg)\n\t\t\t}\n\n\t\t\timplicit := \"\"\n\t\t\tif res.Version == 0 {\n\t\t\t\timplicit = \", implicit\"\n\t\t\t}\n\n\t\t\tfmt.Fprintf(w, \"CID:        %s\\n\", res.Cid)\n\t\t\tfmt.Fprintf(w, \"Version:    %d\\n\", res.Version)\n\t\t\tif res.Version == 0 {\n\t\t\t\tfmt.Fprintf(w, \"Multibase:  %s (implicit)\\n\", res.Multibase.Name)\n\t\t\t} else {\n\t\t\t\tfmt.Fprintf(w, \"Multibase:  %s (%s)\\n\", res.Multibase.Name, res.Multibase.Prefix)\n\t\t\t}\n\t\t\tfmt.Fprintf(w, \"Multicodec: %s (0x%x%s)\\n\", res.Multicodec.Name, res.Multicodec.Code, implicit)\n\t\t\tfmt.Fprintf(w, \"Multihash:  %s (0x%x%s)\\n\", res.Multihash.Name, res.Multihash.Code, implicit)\n\t\t\tfmt.Fprintf(w, \"  Length:   %d bytes\\n\", res.Multihash.Length)\n\t\t\tfmt.Fprintf(w, \"  Digest:   %s\\n\", res.Multihash.Digest)","sourceCodeStart":521,"sourceCodeEnd":557,"githubUrl":"https://github.com/ipfs/kubo/blob/329838acdfafae224582930457efe80aa217afc0/core/commands/cid.go#L521-L557","documentation":"The text encoder for `ipfs cid inspect` re-raises the remote/processing error stored in CidInspectRes.ErrorMsg as the command's error. The message content is whatever the inspect operation put into ErrorMsg, so this is a pass-through of the underlying failure to the CLI user.","triggerScenarios":"Running `ipfs cid inspect` (text output) when the underlying inspection failed and set res.ErrorMsg; the encoder then returns that message as an error.","commonSituations":"Inspecting a malformed or unresolvable CID string; daemon-side failure during inspection surfaced through the text encoder path.","solutions":["Fix the underlying cause reported by the message (usually an invalid or unresolvable CID input)","Re-run with JSON output (`--enc=json`) to see the full structured result including res.ErrorMsg","Validate the CID with `ipfs cid format --format=%s <cid>` or a client-side cid.Decode before inspecting"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"err := cmd.Run()\nif err != nil {\n    var ee *cmds.Error\n    if errors.As(err, &ee) {\n        // inspect ee.Message (the original ErrorMsg) and handle\n    }\n}","preventionTips":["Use --enc=json to get structured error info instead of the text re-raise","Validate the CID input before running inspect","Read the res.ErrorMsg content; it names the true underlying cause"],"tags":["cli","cid","error-passthrough"],"backgroundTag":"error-message-passthrough","analyzedSha":"329838acdfafae224582930457efe80aa217afc0","analyzedAt":"2026-09-03T18:30:52.135Z","contentChangedAt":"2026-09-03T18:30:52.135Z","schemaVersion":2},"datasetVersion":"2026-09-11T00:17:11.886Z"}