systemprompt_runtime/
error.rs1use systemprompt_agent::AgentError;
17use systemprompt_ai::error::RepositoryError as AiRepositoryError;
18use systemprompt_analytics::AnalyticsError;
19use systemprompt_config::paths::PathError;
20use systemprompt_config::{ConfigError as ProfileConfigError, ProfileBootstrapError};
21use systemprompt_content::ContentError;
22use systemprompt_database::RepositoryError;
23use systemprompt_extension::LoaderError;
24use systemprompt_files::FilesError;
25use systemprompt_marketplace::managed::ManagedError;
26use systemprompt_mcp::McpDomainError;
27use systemprompt_models::errors::ConfigError as ModelConfigError;
28use systemprompt_oauth::OauthError;
29use systemprompt_security::policy::GovernanceEngineError;
30use systemprompt_users::UserError;
31use thiserror::Error;
32
33pub type RuntimeResult<T> = Result<T, RuntimeError>;
34
35#[derive(Debug, Error)]
36pub enum RuntimeError {
37 #[error(transparent)]
38 Profile(#[from] ProfileConfigError),
39
40 #[error(transparent)]
41 ProfileBootstrap(#[from] ProfileBootstrapError),
42
43 #[error(transparent)]
44 Config(#[from] ModelConfigError),
45
46 #[error(transparent)]
47 Paths(#[from] PathError),
48
49 #[error(transparent)]
50 Files(#[from] FilesError),
51
52 #[error(transparent)]
53 Users(#[from] UserError),
54
55 #[error(transparent)]
56 Repository(#[from] RepositoryError),
57
58 #[error(transparent)]
59 Analytics(#[from] AnalyticsError),
60
61 #[error(transparent)]
62 AiRepository(#[from] AiRepositoryError),
63
64 #[error(transparent)]
65 Evaluation(#[from] systemprompt_evaluation::EvaluationError),
66
67 #[error(transparent)]
68 Mcp(#[from] McpDomainError),
69
70 #[error(transparent)]
71 Agent(#[from] AgentError),
72
73 #[error(transparent)]
74 Content(#[from] ContentError),
75
76 #[error(transparent)]
77 Oauth(#[from] OauthError),
78
79 #[error(transparent)]
80 Loader(#[from] LoaderError),
81
82 #[error(transparent)]
83 Governance(#[from] GovernanceEngineError),
84
85 #[error(transparent)]
86 Managed(#[from] ManagedError),
87
88 #[error(
89 "Configured system admin '{username}' was not found in the users table. Run `systemprompt \
90 admin bootstrap` first."
91 )]
92 SystemAdminNotFound { username: String },
93
94 #[error(
95 "Configured system admin '{username}' exists but is not active. Re-activate the user \
96 before starting the platform."
97 )]
98 SystemAdminInactive { username: String },
99
100 #[error(
101 "Configured system admin '{username}' exists but does not carry the 'admin' role. Grant \
102 the role before starting the platform."
103 )]
104 SystemAdminMissingRole { username: String },
105
106 #[error(
107 "Configured GeoIP database at '{path}' could not be loaded: {message}. Fix or remove \
108 paths.geoip_database from the profile."
109 )]
110 GeoIpUnreadable { path: String, message: String },
111
112 #[error("DATABASE_URL is empty")]
113 EmptyDatabaseUrl,
114
115 #[error("Database not found at '{path}'. Run setup first")]
116 DatabaseNotFound { path: String },
117
118 #[error("Database path '{path}' exists but is not a file")]
119 DatabaseNotFile { path: String },
120
121 #[error("internal: {0}")]
122 Internal(String),
123}