| Previous | Next |
| ENOSPC | EROFS |
ESPIPE
What cannot be repositioned
ESPIPE means an operation tried to use a file position on an object that has no seekable byte offset. Pipes, FIFOs, and sockets carry a stream of data rather than exposing a stable position that can be moved backward, forward, or queried like an ordinary file. The same limitation commonly applies to terminals and some devices.
The error is most often returned by lseek(), but a higher-level stream function can surface the same condition when it eventually asks the underlying descriptor to seek. It does not mean that the stream is broken. It means the application selected a file-oriented operation for a sequential data source.
How to handle it
- Classify the descriptor before using seek-based APIs: regular file, seekable block device, pipe, FIFO, socket, terminal, or stream wrapper.
- For pipes and sockets, keep the required bytes in an application buffer if protocol parsing needs lookahead or replay.
- When an API needs random access, stage the stream into a temporary regular file or redesign the format for sequential processing.
- Do not retry
lseek()on the same nonseekable descriptor; the capability cannot appear without changing the underlying object.
References
Looking for a different code? Search another status or error code.