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