{"record":{"id":"8d871f3035b90f9b","repo":"cloudreve/cloudreve","slug":"failed-to-read-info-of-q-s-skipping","errorCode":null,"errorMessage":"failed to read info of %q: %s, skipping...","messagePattern":"failed to read info of %q: (.+?), skipping\\.\\.\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"application/statics/statics.go","lineNumber":179,"sourceCode":"\t})\n\n\tvar embedFS FS\n\tembedFS.files = &files\n\treturn embedFS\n}\n\n// Eject 抽离内置静态资源\nfunc Eject(l logging.Logger, statics fs.FS) error {\n\t// 初始化静态资源\n\tembedFS, err := fs.Sub(statics, \"assets/build\")\n\tif err != nil {\n\t\tl.Panic(\"Failed to initialize static resources: %s\", err)\n\t}\n\n\tvar walk func(relPath string, d fs.DirEntry, err error) error\n\twalk = func(relPath string, d fs.DirEntry, err error) error {\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"failed to read info of %q: %s, skipping...\", relPath, err)\n\t\t}\n\n\t\tif !d.IsDir() {\n\t\t\t// 写入文件\n\t\t\tdst := util.DataPath(filepath.Join(StaticFolder, relPath))\n\t\t\tout, err := util.CreatNestedFile(dst)\n\t\t\tdefer out.Close()\n\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"failed to create file %q: %s, skipping...\", dst, err)\n\t\t\t}\n\n\t\t\tl.Info(\"Ejecting %q...\", dst)\n\t\t\tobj, _ := embedFS.Open(relPath)\n\t\t\tif _, err := io.Copy(out, bufio.NewReader(obj)); err != nil {\n\t\t\t\treturn fmt.Errorf(\"cannot write file %q: %s, skipping...\", relPath, err)\n\t\t\t}\n\t\t}","sourceCodeStart":161,"sourceCodeEnd":197,"githubUrl":"https://github.com/cloudreve/cloudreve/blob/20c95ad73f3a8bcb72887fea91ff31ab24fa1011/application/statics/statics.go#L161-L197","documentation":"Produced by the Eject walk when fs.WalkDir hands its callback an error for an entry while exporting embedded static resources to disk (application/statics/statics.go:177-180). It formats the cause with %s, so errors.Is/errors.As cannot see through it. Although the message says 'skipping...', the code returns the error, which stops the entire walk and fails Eject - the skip is not actually performed.","triggerScenarios":"Reading a directory entry from the in-memory FS fails (corrupt embedded zip, same class as errors 115-117); d.Info() failing for an entry; memory pressure while enumerating a large archive. Because the FS is the already-materialized in-memory one, occurrences indicate a broken embedded archive rather than disk trouble.","commonSituations":"Running the eject command on a binary whose assets.zip is subtly corrupt; forks with modified asset pipelines producing odd entries.","solutions":["Treat it as a broken embedded archive: rebuild the binary with a freshly built assets.zip.","Validate the embedded archive independently (unzip -t on the source zip used at build time).","If you want per-file resilience, change the handler to log and return nil so the walk really skips the entry, matching the message.","Note the %s formatting: to inspect the cause programmatically, change it to %w first."],"exampleFix":"// before\nif err != nil {\n\treturn fmt.Errorf(\"failed to read info of %q: %s, skipping...\", relPath, err)\n}\n\n// after - honor the \"skipping\" intent and keep the error chain\nif err != nil {\n\tl.Warning(\"failed to read info of %q, skipping: %s\", relPath, err)\n\treturn nil\n}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"// The message says \"skipping...\" but the shipped code returns the error,\n// aborting the whole eject. Honor the intent:\nif err != nil {\n\tl.Warning(\"failed to read info of %q, skipping: %s\", relPath, err)\n\treturn nil // continue walking siblings\n}\n// Note: shipped code uses %s, so errors.Is/As cannot see the cause.","preventionTips":["Rebuild the binary when embedded-archive walk errors appear; the source is inside the binary.","Use %w (not %s) in wrapped errors so callers can classify causes.","Decide skip-vs-abort explicitly: returning the error from a WalkDir callback stops the entire tree walk."],"tags":["go","cloudreve","static-assets","eject","error-wrapping","walk"],"backgroundTag":null,"analyzedSha":"20c95ad73f3a8bcb72887fea91ff31ab24fa1011","analyzedAt":"2026-08-16T01:42:55.403Z","schemaVersion":2},"datasetVersion":"2026-08-16T03:17:38.424Z"}