Implementation:Ray project Ray UnreconstructableException
| Knowledge Sources | |
|---|---|
| Domains | Distributed_Computing, Java_API |
| Last Updated | 2026-02-13 16:00 GMT |
Overview
Exception class indicating that a Ray object is lost and cannot be reconstructed, provided by the Ray Java API.
Description
UnreconstructableException extends RayException and is thrown when an object has been lost (either evicted from the object store or explicitly deleted) and cannot be reconstructed by re-running its creating task. This exception only applies to actor objects: if an actor's current state is after the object's creating task, the actor cannot re-run the task to reconstruct the object. The exception stores the ObjectId of the lost object.
Usage
This exception is thrown by the Ray runtime when attempting to retrieve a lost object. Catch it in application code to handle cases where actor state prevents task replay, and the object must be recomputed through other means.
Code Reference
Source Location
- Repository: Ray
- File:
java/api/src/main/java/io/ray/api/exception/UnreconstructableException.java
Signature
public class UnreconstructableException extends RayException {
public ObjectId objectId;
public UnreconstructableException(ObjectId objectId);
public UnreconstructableException(String message);
public UnreconstructableException(String message, Throwable cause);
}
Import
import io.ray.api.exception.UnreconstructableException;
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| objectId | ObjectId |
Yes | Identifier of the lost object that cannot be reconstructed |
| message | String |
No | Custom error message (alternative constructor) |
| cause | Throwable |
No | The underlying cause of the exception |
Outputs
| Name | Type | Description |
|---|---|---|
| exception | UnreconstructableException |
Exception instance identifying the lost object |
Usage Examples
ObjectRef<byte[]> dataRef = actor.task(MyActor::generateData).remote();
try {
byte[] data = dataRef.get();
} catch (UnreconstructableException e) {
System.err.println("Object " + e.objectId + " is lost and cannot be reconstructed.");
// Recompute the data through alternative means
dataRef = actor.task(MyActor::generateData).remote();
}