{"record":{"id":"f88459c9507bb482","repo":"cloudflare/cloudflared","slug":"errinsufficientlines","errorCode":"ErrInsufficientLines","errorMessage":"insufficient lines","messagePattern":"insufficient lines","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"diagnostic/error.go","lineNumber":13,"sourceCode":"package diagnostic\n\nimport (\n\t\"errors\"\n)\n\nvar (\n\t// Error used when there is no log directory available.\n\tErrManagedLogNotFound = errors.New(\"managed log directory not found\")\n\t// Error used when it is not possible to collect logs using the log configuration.\n\tErrLogConfigurationIsInvalid = errors.New(\"provided log configuration is invalid\")\n\t// Error used when parsing the fields of the output of collector.\n\tErrInsufficientLines = errors.New(\"insufficient lines\")\n\t// Error used when parsing the lines of the output of collector.\n\tErrInsuficientFields = errors.New(\"insufficient fields\")\n\t// Error used when given key is not found while parsing KV.\n\tErrKeyNotFound = errors.New(\"key not found\")\n\t// Error used when there is no disk volume information available.\n\tErrNoVolumeFound = errors.New(\"no disk volume information found\")\n\t// Error user when the base url of the diagnostic client is not provided.\n\tErrNoBaseURL = errors.New(\"no base url\")\n\t// Error used when no metrics server is found listening to the known addresses list (check [metrics.GetMetricsKnownAddresses]).\n\tErrMetricsServerNotFound = errors.New(\"metrics server not found\")\n\t// Error used when multiple metrics server are found listening to the known addresses list (check [metrics.GetMetricsKnownAddresses]).\n\tErrMultipleMetricsServerFound = errors.New(\"multiple metrics server found\")\n\t// Error used when a temporary file creation fails within the diagnostic procedure\n\tErrCreatingTemporaryFile = errors.New(\"temporary file creation failed\")\n)\n","sourceCodeStart":1,"sourceCodeEnd":29,"githubUrl":"https://github.com/cloudflare/cloudflared/blob/2253eeeb25a44a713a4b60b8ba1e1b3f377d1a0f/diagnostic/error.go#L1-L29","documentation":"ErrInsufficientLines is a sentinel error in diagnostic/error.go used when parsing the output of a collector: the raw output does not contain the minimum number of lines the parser requires. Parsers for system information (disk volumes, OS info, file descriptors) split command output into lines and count them; if fewer lines than expected are produced, this error is wrapped into the returned error. It signals the underlying tool produced truncated, empty, or unexpected output.","triggerScenarios":"Any parser in the diagnostic package that splits collector command output by lines and finds fewer than the required minimum — e.g. disk volume, OS information, or file descriptor parsers receiving empty or truncated stdout from the backing command (df/uname/sysctl-like commands) on a remote or containerized instance.","commonSituations":"Running diagnostics in minimal containers where system utilities are missing or stubbed and emit no output; remote diagnostic HTTP clients collecting from a container whose tooling differs from the host; locale/permission issues causing a command to fail and print nothing; output truncated by an intermediate layer.","solutions":["Run the diagnostics again targeting the correct environment (--diag-container-id / --diag-pod-id) so the parser reads output from an environment that has the expected system utilities.","Verify the backing system commands (disk volume, uname, file descriptor queries) exist and run inside the target environment; install the missing utilities in the container image.","Inspect the raw collector output (enable debug logging) to confirm whether it is empty, truncated, or in an unexpected format, and address the underlying command failure.","Update cloudflared if the target platform's tool output format changed and the bundled parser expects an older layout."],"exampleFix":"// before: minimal container image missing system tools, diag fails\nFROM alpine\nRUN cloudflared ...\n\n// after: include the tools the diagnostic parsers rely on\nFROM alpine\nRUN apk add --no-cache coreutils util-linux e2fsprogs\nRUN cloudflared ...","handlingStrategy":"validation","validationCode":"// Go: verify the collector output has enough lines before parsing\nlines := strings.Split(string(output), \"\\n\")\nif len(lines) < minimumLines {\n    // treat output as unavailable; skip parsing\n}","typeGuard":"func hasEnoughLines(out string, min int) bool {\n    return len(strings.FieldsFunc(out, func(r rune) bool { return r == '\\n' })) >= min\n}","tryCatchPattern":"info, err := parser.Parse(output)\nif errors.Is(err, diagnostic.ErrInsufficientLines) {\n    log.Warn().Msg(\"collector output truncated/empty; skipping\")\n    return nil\n}","preventionTips":["Verify the system utilities the collector depends on exist in the target container image.","Target diagnostics at the right environment with --diag-container-id/--diag-pod-id.","Check for command failures (permissions, locale) that yield empty output before parsing.","Retry collection once on empty output; transient truncation is common over remote collection."],"tags":["diagnostics","parsing","cloudflared"],"backgroundTag":"empty-result-set","analyzedSha":"2253eeeb25a44a713a4b60b8ba1e1b3f377d1a0f","analyzedAt":"2026-09-06T04:14:33.757Z","contentChangedAt":"2026-09-06T04:14:33.757Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}