cellos_core/error.rs
1use thiserror::Error;
2
3/// Typed errors for library boundaries (`thiserror`).
4#[derive(Debug, Error)]
5pub enum CellosError {
6 #[error("invalid cell specification: {0}")]
7 InvalidSpec(String),
8
9 /// FC-66 — typed admission rejection for an over-sized `spec.run.argv`.
10 ///
11 /// Surfaced by the FC-17 admission helper
12 /// `check_argv_size_within_kernel_cmdline_limit`. The Firecracker host
13 /// encodes `spec.run.argv` as `cellos.argv=<base64(json_array)>` on the
14 /// kernel boot cmdline; the kernel cmdline has a 4 KiB hard limit and is
15 /// silently truncated past that. We budget a 3 KiB cap on the encoded
16 /// payload (≈1 KiB of headroom for the rest of the cmdline) and reject
17 /// over-sized argv at admission so callers see a structured error rather
18 /// than an opaque in-VM boot failure later.
19 ///
20 /// `encoded_bytes` is the length of the base64-encoded JSON-array form of
21 /// `argv` (i.e. exactly what the host would write into the cmdline).
22 /// `limit_bytes` is the static cap (3072) so callers/operators do not have
23 /// to dig into core to see the budget.
24 #[error(
25 "spec.run.argv encoded as base64 is {encoded_bytes} bytes; \
26 exceeds {limit_bytes}-byte kernel cmdline limit"
27 )]
28 ArgvTooLarge {
29 encoded_bytes: usize,
30 limit_bytes: usize,
31 },
32
33 #[error("host backend: {0}")]
34 Host(String),
35
36 #[error("event sink: {0}")]
37 EventSink(String),
38
39 #[error("secret broker: {0}")]
40 SecretBroker(String),
41
42 #[error("export sink: {0}")]
43 ExportSink(String),
44
45 #[error("lifecycle: {0}")]
46 Lifecycle(String),
47
48 #[error("inference broker: {0}")]
49 InferenceBroker(String),
50}