{"record":{"id":"2317052fba4cd470","repo":"hashicorp/nomad","slug":"error-tailing-file-v-231705","errorCode":null,"errorMessage":"error tailing file: %v","messagePattern":"error tailing file: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"command/alloc_logs.go","lineNumber":304,"sourceCode":"\t\tif nLines, nBytes := l.numLines != -1, l.numBytes != -1; nLines && nBytes {\n\t\t\treturn errors.New(\"both -n and -c set\")\n\t\t} else if nLines {\n\t\t\toffset = l.numLines * bytesToLines\n\t\t} else if nBytes {\n\t\t\toffset = l.numBytes\n\t\t} else {\n\t\t\tl.numLines = defaultTailLines\n\t\t}\n\n\t\tr, readErr = l.followFile(client, alloc, logType, api.OriginEnd, offset)\n\n\t\t// If numLines is set, wrap the reader\n\t\tif l.numLines != -1 {\n\t\t\tr = NewLineLimitReader(r, int(l.numLines), int(l.numLines*bytesToLines), 1*time.Second)\n\t\t}\n\n\t\tif readErr != nil {\n\t\t\treturn fmt.Errorf(\"error tailing file: %v\", readErr)\n\t\t}\n\t}\n\n\tdefer r.Close()\n\tif _, err := io.Copy(os.Stdout, r); err != nil {\n\t\treturn fmt.Errorf(\"error following logs: %s\", err)\n\t}\n\n\treturn nil\n}\n\n// followFile outputs the contents of the file to stdout relative to the end of\n// the file.\nfunc (l *AllocLogsCommand) followFile(client *api.Client, alloc *api.Allocation,\n\tlogType, origin string, offset int64) (io.ReadCloser, error) {\n\n\tcancel := make(chan struct{})\n\tframes, errCh := client.AllocFS().Logs(alloc, l.follow, l.task, logType, origin, offset, cancel, nil)","sourceCodeStart":286,"sourceCodeEnd":322,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/command/alloc_logs.go#L286-L322","documentation":"Fires in handleSingleFile when tailing (-f style): opening the log at OriginEnd with the computed offset failed, so the tail stream could not be established.","triggerScenarios":"Thrown at command/alloc_logs.go:304 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check that the task is running and log files exist on the client","Verify -n/-c offset values are sensible","Retry; transient client streaming failures may resolve"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"482b49bf1aec006f089bcfc7e632d8f6ac303e5e","analyzedAt":"2026-09-04T07:54:14.808Z","contentChangedAt":"2026-09-04T07:54:14.808Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}