Skip to main content

aether_project/
error.rs

1//! Error types for settings loading and validation.
2
3use thiserror::Error;
4
5/// Errors that can occur during settings loading and agent resolution.
6#[derive(Debug, Error)]
7pub enum SettingsError {
8    /// The settings file exists but could not be parsed.
9    #[error("Failed to parse settings file: {0}")]
10    ParseError(String),
11
12    /// An agent entry has an invalid model string.
13    #[error("Invalid model '{model}' for agent '{agent}': {error}")]
14    InvalidModel {
15        agent: String,
16        model: String,
17        error: String,
18    },
19
20    /// An agent entry has an invalid reasoning effort string.
21    #[error("Invalid reasoningEffort '{effort}' for agent '{agent}': {error}")]
22    InvalidReasoningEffort {
23        agent: String,
24        effort: String,
25        error: String,
26    },
27
28    /// An agent entry is missing required fields.
29    #[error("Agent '{agent}' is missing required field: {field}")]
30    MissingField { agent: String, field: String },
31
32    /// An agent entry has an empty name.
33    #[error("Agent at index {index} has an empty name")]
34    EmptyAgentName { index: usize },
35
36    /// An agent entry uses a reserved name.
37    #[error("Agent name '{name}' is reserved and cannot be used")]
38    ReservedAgentName { name: String },
39
40    /// Duplicate agent names.
41    #[error("Duplicate agent name: '{name}'")]
42    DuplicateAgentName { name: String },
43
44    /// An agent has no invocation surface enabled.
45    #[error(
46        "Agent '{agent}' must have at least one invocation flag (userInvocable or agentInvocable)"
47    )]
48    NoInvocationSurface { agent: String },
49
50    /// A prompt glob pattern is syntactically invalid.
51    #[error("Invalid glob pattern '{pattern}' for agent '{agent}': {error}")]
52    InvalidGlobPattern {
53        agent: String,
54        pattern: String,
55        error: String,
56    },
57
58    /// An inherited prompt glob pattern is syntactically invalid.
59    #[error("Invalid inherited glob pattern '{pattern}': {error}")]
60    InvalidInheritedGlobPattern { pattern: String, error: String },
61
62    /// A prompt entry resolves to zero files.
63    #[error("Prompt entry '{pattern}' for agent '{agent}' resolves to no files")]
64    ZeroMatchPrompt { agent: String, pattern: String },
65
66    /// An inherited prompt entry resolves to zero files.
67    #[error("Inherited prompt entry '{pattern}' resolves to no files")]
68    ZeroMatchInheritedPrompt { pattern: String },
69
70    /// An agent has no prompts after inheritance.
71    #[error("Agent '{agent}' has no prompts after inheritance (neither inherited nor local)")]
72    NoPrompts { agent: String },
73
74    /// An MCP config path does not exist or is invalid.
75    #[error("MCP config path '{path}' does not exist or is not a file")]
76    InvalidMcpConfigPath { path: String },
77
78    /// I/O error while reading files.
79    #[error("I/O error: {0}")]
80    IoError(String),
81
82    /// An agent was not found in the catalog.
83    #[error("Agent '{name}' not found")]
84    AgentNotFound { name: String },
85
86    /// Duplicate prompt names in the catalog.
87    #[error("Duplicate prompt name: '{name}'")]
88    DuplicatePromptName { name: String },
89}