# error: read /dev/urandom: expected 1024 bytes, got 512

- **ID:** `go/io-read-write-count-mismatch`
- **Domain:** go
- **Category:** io_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

An io.Reader returned fewer bytes than requested without returning an error, violating the io.Reader contract.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 1.16 | active | — | — |

## Workarounds

1. **** (95% success)
   ```
   Use io.ReadFull to ensure the exact number of bytes are read.
   ```
2. **** (90% success)
   ```
   Loop over io.Read until the desired count is reached or an error occurs.
   ```

## Dead Ends

- **** — This leads to data corruption and undefined behavior. (95% fail)
- **** — The buffer size doesn't affect the reader's behavior; it may still return short reads. (80% fail)
