Skip to main content

rivetkit_engine_process/
error.rs

1use rivet_error::RivetError;
2use serde::{Deserialize, Serialize};
3
4#[derive(RivetError, Debug, Clone, Deserialize, Serialize)]
5#[error("engine")]
6pub enum EngineProcessError {
7	#[error(
8		"binary_not_found",
9		"Engine binary was not found.",
10		"Engine binary was not found at '{path}'."
11	)]
12	BinaryNotFound { path: String },
13
14	#[error(
15		"binary_unavailable",
16		"Engine binary is unavailable.",
17		"No usable engine binary was found for version '{version}'. Build `rivet-engine`, set `RIVET_ENGINE_BINARY_PATH`, or install the matching `@rivetkit/engine-cli` platform package."
18	)]
19	BinaryUnavailable { version: String },
20
21	#[error(
22		"download_failed",
23		"Engine binary download failed.",
24		"Engine binary download failed for '{url}': {reason}"
25	)]
26	DownloadFailed { url: String, reason: String },
27
28	#[error(
29		"checksum_mismatch",
30		"Engine binary checksum mismatch.",
31		"Engine binary checksum mismatch for '{artifact}': expected {expected}, received {received}."
32	)]
33	ChecksumMismatch {
34		artifact: String,
35		expected: String,
36		received: String,
37	},
38
39	#[error(
40		"invalid_endpoint",
41		"Engine endpoint is invalid.",
42		"Engine endpoint '{endpoint}' is invalid: {reason}"
43	)]
44	InvalidEndpoint { endpoint: String, reason: String },
45
46	#[error("missing_pid", "Engine process is missing a pid.")]
47	MissingPid,
48
49	#[error(
50		"health_check_failed",
51		"Engine health check failed.",
52		"Engine health check failed after {attempts} attempts: {reason}"
53	)]
54	HealthCheckFailed { attempts: u32, reason: String },
55
56	#[error(
57		"port_occupied",
58		"Engine port is occupied by a different runtime.",
59		"Cannot start engine: endpoint '{endpoint}' is already serving runtime '{runtime}'. Stop that process and retry."
60	)]
61	PortOccupied { endpoint: String, runtime: String },
62
63	#[error(
64		"incompatible_engine",
65		"An incompatible engine is already running on the endpoint.",
66		"Cannot use the engine at '{endpoint}': it is Rivet Engine {version} with architecture '{architecture}', but this RivetKit requires a {required} engine. Stop that engine process (it may have been started by an older RivetKit) and retry, or point RIVET_ENDPOINT at a {required} engine."
67	)]
68	IncompatibleEngine {
69		endpoint: String,
70		version: String,
71		architecture: String,
72		required: String,
73	},
74
75	#[error(
76		"incompatible_binary",
77		"The Engine binary is incompatible with this RivetKit.",
78		"Cannot start Engine binary '{path}': {reason}; this RivetKit requires a {required} engine. Build the matching v3 Engine and configure its executable for local startup (RIVET_ENGINE_BINARY in JavaScript, RIVET_ENGINE_BINARY_PATH in Rust)."
79	)]
80	IncompatibleBinary {
81		path: String,
82		reason: String,
83		required: String,
84	},
85
86	#[error(
87		"not_ready",
88		"Engine did not become ready.",
89		"Engine answered health checks but could not serve actor requests after {attempts} attempts: {reason}"
90	)]
91	NotReady { attempts: u32, reason: String },
92}