{"record":{"id":"92c7bcce43856c76","repo":"hashicorp/nomad","slug":"error-reading-file-v","errorCode":null,"errorMessage":"Error reading file: %v","messagePattern":"Error reading file: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"command/alloc_fs.go","lineNumber":296,"sourceCode":"\t\t\t\tfn,\n\t\t\t)\n\t\t}\n\t\tf.Ui.Output(formatList(out))\n\t\treturn 0\n\t}\n\n\t// We have a file, output it.\n\tvar r io.ReadCloser\n\tvar readErr error\n\tif !tail {\n\t\tif follow {\n\t\t\tr, readErr = f.followFile(client, alloc, path, api.OriginStart, 0, -1)\n\t\t} else {\n\t\t\tr, readErr = client.AllocFS().Cat(alloc, path, nil)\n\t\t}\n\n\t\tif readErr != nil {\n\t\t\treadErr = fmt.Errorf(\"Error reading file: %v\", readErr)\n\t\t}\n\t} else {\n\t\t// Parse the offset\n\t\tvar offset int64 = defaultTailLines * bytesToLines\n\n\t\tif nLines, nBytes := numLines != -1, numBytes != -1; nLines && nBytes {\n\t\t\tf.Ui.Error(\"Both -n and -c are not allowed\")\n\t\t\treturn 1\n\t\t} else if numLines < -1 || numBytes < -1 {\n\t\t\tf.Ui.Error(\"Invalid size is specified\")\n\t\t\treturn 1\n\t\t} else if nLines {\n\t\t\toffset = numLines * bytesToLines\n\t\t} else if nBytes {\n\t\t\toffset = numBytes\n\t\t} else {\n\t\t\tnumLines = defaultTailLines\n\t\t}","sourceCodeStart":278,"sourceCodeEnd":314,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/command/alloc_fs.go#L278-L314","documentation":"nomad alloc fs CLI error: reading the full allocation file via client.AllocFS().Cat (or followFile when -follow is set without tail) failed; the API error is wrapped and reported to the user before the command exits.","triggerScenarios":"Thrown at command/alloc_fs.go:296 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify the allocation ID and file path exist inside the task sandbox","Check the client is reachable and the allocation is running","Retry on transient network errors; use -tail to stream large files instead of Cat"],"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"}