{"record":{"id":"76d47b246ad6167d","repo":"tsenart/vegeta","slug":"strings-join-errs","errorCode":null,"errorMessage":"strings.Join(errs, \"; \")","messagePattern":"strings\\.Join\\(errs, \"; \"\\)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"file.go","lineNumber":58,"sourceCode":"\n\t\tdecs = append(decs, dec)\n\t\tcloser = append(closer, rc)\n\t}\n\treturn vegeta.NewRoundRobinDecoder(decs...), closer, nil\n}\n\ntype multiCloser []io.Closer\n\nfunc (mc multiCloser) Close() error {\n\tvar errs []string\n\tfor _, c := range mc {\n\t\tif err := c.Close(); err != nil {\n\t\t\terrs = append(errs, err.Error())\n\t\t}\n\t}\n\n\tif len(errs) > 0 {\n\t\treturn errors.New(strings.Join(errs, \"; \"))\n\t}\n\n\treturn nil\n}\n","sourceCodeStart":40,"sourceCodeEnd":63,"githubUrl":"https://github.com/tsenart/vegeta/blob/cf5811269046c672a604b1eb352204d30f16ae4a/file.go#L40-L63","documentation":"Close aggregates errors from closing every writer in the multiwriter; if any individual Close fails, it joins all messages with \"; \" into a single error. It indicates that one or more output sinks (e.g. report files) could not be closed/flushed.","triggerScenarios":"Closing a MultiCloser (used by attack output handling and writeReport) where any underlying writer's Close returns an error, e.g. an unwritable file, disk full, or an HTTP body close failure.","commonSituations":"Report output file on a full disk or read-only filesystem; closing a network writer whose peer already closed; double-closing a writer.","solutions":["Inspect the joined message to find which writer(s) failed, then fix that sink (permissions, disk space, path).","Ensure the output directory/file is writable before running the attack.","Handle Close errors in your own wrapper writers so the aggregate is meaningful."],"exampleFix":"// before\nf, _ := os.Create(\"/ro/report.bin\")\n// after\nf, err := os.Create(\"/tmp/report.bin\")\nif err != nil { log.Fatal(err) }","handlingStrategy":"try-catch","validationCode":"for _, w := range writers {\n    if f, ok := w.(*os.File); ok {\n        if _, err := f.Stat(); err != nil { return err }\n    }\n}","typeGuard":null,"tryCatchPattern":"if err := closers.Close(); err != nil {\n    for _, part := range strings.Split(err.Error(), \"; \") {\n        log.Printf(\"close failure: %s\", part)\n    }\n}","preventionTips":["Pre-create output files in a writable directory","Monitor disk space on attack hosts","Log per-writer close errors inside custom writers"],"tags":["io","cleanup","multi-error"],"backgroundTag":"resource-close-failed","analyzedSha":"cf5811269046c672a604b1eb352204d30f16ae4a","analyzedAt":"2026-08-31T11:04:20.464Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}