hashicorp/nomad · error

Error reading file: %v

Error message

Error reading file: %v

What it means

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.

Source

Thrown at command/alloc_fs.go:296

				fn,
			)
		}
		f.Ui.Output(formatList(out))
		return 0
	}

	// We have a file, output it.
	var r io.ReadCloser
	var readErr error
	if !tail {
		if follow {
			r, readErr = f.followFile(client, alloc, path, api.OriginStart, 0, -1)
		} else {
			r, readErr = client.AllocFS().Cat(alloc, path, nil)
		}

		if readErr != nil {
			readErr = fmt.Errorf("Error reading file: %v", readErr)
		}
	} else {
		// Parse the offset
		var offset int64 = defaultTailLines * bytesToLines

		if nLines, nBytes := numLines != -1, numBytes != -1; nLines && nBytes {
			f.Ui.Error("Both -n and -c are not allowed")
			return 1
		} else if numLines < -1 || numBytes < -1 {
			f.Ui.Error("Invalid size is specified")
			return 1
		} else if nLines {
			offset = numLines * bytesToLines
		} else if nBytes {
			offset = numBytes
		} else {
			numLines = defaultTailLines
		}

View on GitHub (pinned to 482b49bf1a)

Solutions

  1. Verify the allocation ID and file path exist inside the task sandbox
  2. Check the client is reachable and the allocation is running
  3. Retry on transient network errors; use -tail to stream large files instead of Cat
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at command/alloc_fs.go:296 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of hashicorp/nomad@482b49bf1a (2026-09-04). Data as JSON: /api/errors/92c7bcce43856c76. Report an issue: GitHub.