{"record":{"id":"f819234dca39159d","repo":"cloudflare/cloudflared","slug":"scanner-reported-an-error-w","errorCode":null,"errorMessage":"scanner reported an error: %w","messagePattern":"scanner reported an error: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"diagnostic/network/collector_utils.go","lineNumber":70,"sourceCode":"\t\ttext := scanner.Text()\n\t\tif text == \"\" {\n\t\t\tcontinue\n\t\t}\n\n\t\thop, err := decodeLine(text)\n\t\tif err != nil {\n\t\t\t// This continue is here on the error case because there are lines at the start and end\n\t\t\t// that may not be parsable. (check windows tracert output)\n\t\t\t// The skip is here because aside from the start and end lines the other lines should\n\t\t\t// always be parsable without errors.\n\t\t\tcontinue\n\t\t}\n\n\t\thops = append(hops, hop)\n\t}\n\n\tif scanner.Err() != nil {\n\t\treturn nil, fmt.Errorf(\"scanner reported an error: %w\", scanner.Err())\n\t}\n\n\treturn hops, nil\n}\n","sourceCodeStart":52,"sourceCodeEnd":75,"githubUrl":"https://github.com/cloudflare/cloudflared/blob/2253eeeb25a44a713a4b60b8ba1e1b3f377d1a0f/diagnostic/network/collector_utils.go#L52-L75","documentation":"Decode reads traceroute output line by line via a bufio.Scanner and returns the parsed hops. If the underlying reader produced an I/O error during scanning (scanner.Err() != nil), Decode wraps it with this message. It indicates the traceroute output stream was interrupted, not that a line was unparseable.","triggerScenarios":"The stdout pipe from the traceroute process returns an I/O error while Decode reads it — process killed abruptly breaking the pipe, or read errors on the pipe; also reachable if a scanner buffer limit is exceeded, though that surfaces as bufio.ErrTooLong through Err().","commonSituations":"Traceroute process crashing mid-output; extremely long output lines exceeding bufio.Scanner's default 64KB token limit; pipe errors under fd pressure.","solutions":["Check the raw traceroute output (the collector tees it) for truncation or garbage.","If lines are unusually long, raise the scanner buffer in a fork/patch: scanner.Buffer(make([]byte, 0, 64*1024), 1024*1024).","Verify traceroute completes normally; a crashed process breaks the pipe mid-read.","Retry the diagnostic collection."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"// ensure traceroute terminates normally first\ncmd := exec.Command(\"traceroute\", \"-n\", \"-m\", \"15\", host)\nif err := cmd.Run(); err != nil {\n\t// traceroute itself fails; decoding will see pipe errors\n}","typeGuard":null,"tryCatchPattern":"hops, raw, err := network.Collect(ctx, cfg)\nif err != nil {\n\t// raw output tee is still available for manual inspection\n\tlog.Warn().Err(err).Str(\"raw\", raw).Msg(\"decode failed\")\n}","preventionTips":["Let traceroute finish; don't kill it mid-run","Keep hop output lines small (use -n to skip DNS) to avoid scanner buffer limits","Use the raw tee output preserved by the collector for debugging","Retry collection on transient pipe errors"],"tags":["diagnostics","network","traceroute","io"],"backgroundTag":"network-request-failed","analyzedSha":"2253eeeb25a44a713a4b60b8ba1e1b3f377d1a0f","analyzedAt":"2026-09-06T04:14:33.757Z","contentChangedAt":"2026-09-06T04:14:33.757Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}