{"record":{"id":"5fe9bf631baacd0d","repo":"ipfs/kubo","slug":"failed-to-read-file-contents-w","errorCode":null,"errorMessage":"failed to read file contents: %w","messagePattern":"failed to read file contents: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/commands/multibase.go","lineNumber":71,"sourceCode":"\t\tcmds.StringOption(mbaseOptionName, \"multibase encoding\").WithDefault(\"base64url\"),\n\t},\n\tRun: func(req *cmds.Request, resp cmds.ResponseEmitter, env cmds.Environment) error {\n\t\tif err := req.ParseBodyArgs(); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tencoderName, _ := req.Options[mbaseOptionName].(string)\n\t\tencoder, err := mbase.EncoderByName(encoderName)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tfiles := req.Files.Entries()\n\t\tfile, err := cmdenv.GetFileArg(files)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"failed to access file: %w\", err)\n\t\t}\n\t\tbuf, err := io.ReadAll(file)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"failed to read file contents: %w\", err)\n\t\t}\n\t\tencoded := encoder.Encode(buf)\n\t\treader := strings.NewReader(encoded)\n\t\treturn resp.Emit(reader)\n\t},\n}\n\nvar mbaseDecodeCmd = &cmds.Command{\n\tHelptext: cmds.HelpText{\n\t\tTagline: \"Decode multibase string\",\n\t\tLongDescription: `\nThis command expects multibase inside of a file or via stdin:\n\n  > echo -n hello | ipfs multibase encode -b base16 > file\n  > cat file\n  f68656c6c6f\n\n  > ipfs multibase decode file","sourceCodeStart":53,"sourceCodeEnd":89,"githubUrl":"https://github.com/ipfs/kubo/blob/329838acdfafae224582930457efe80aa217afc0/core/commands/multibase.go#L53-L89","documentation":"Failure in `ipfs multibase encode` after the input was opened: io.ReadAll failed while reading the file/stdin bytes (I/O error, read failure on a special file). The encoder was resolved fine; the raw data could not be retrieved.","triggerScenarios":"Thrown at core/commands/multibase.go:71 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Retry the command — a transient I/O error may not recur","Copy the data to a regular file and encode that","Check disk/device health if reading from unusual media"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}