# Backend Error Contract
`VyreBackend::dispatch` returns `Result<Vec<u8>, String>`. Both success and failure are part of the contract.
## Success Contract
- The returned `Vec<u8>` must contain exactly `output_size` bytes.
- No extra padding, no truncation, no uninitialized bytes.
- The bytes must be the exact result of executing the supplied WGSL on the supplied input under the supplied `DispatchConfig`.
## Error Contract
Every error string must contain a `Fix: ...` clause that tells the backend author exactly what to change.
### Acceptable Errors
Returning `Err` is acceptable **only** when the dispatch exceeds a documented backend limit that is outside the conformance profile:
- Unsupported convention version
- Missing required device feature (detected at backend construction)
- Input or output size larger than the backend's published maximum
### Conformance-Violation Errors
Returning `Err` is a **conformance failure** when:
- The WGSL is valid.
- The input is valid for the operation signature.
- The convention is supported (`config.convention <= backend.max_convention()`).
- The dispatch size is within the backend's declared limits.
Examples of conformance-violation errors:
- WGSL compile failure on valid shader source
- Pipeline creation failure
- Timeout or device loss
- Readback failure
- Unsupported valid input
## Error Message Style
Bad: `"dispatch failed"`
Good: `"dispatch failed: workgroup size 256 exceeds backend limit 128. Fix: reduce workgroup_size to <= 128 or increase the backend's declared max workgroup size."`
Bad: `"GPU error"`
Good: `"GPU produced 8 bytes, expected 16. Fix: size the output buffer from output_size and do not truncate readback."`