Public declaration syntax from forge-rs/crates/forge-core/src/error.rs Original source SHA-256: 4a2c5c2bf0ec528a071a0e3469d1888c4a7331ed32252c164b0cf711826b131f Function bodies and constant values are omitted. This is not the complete implementation. Source line 23 #[derive(Debug, Error)] pub enum ForgeError { /// A provider was not found in the registry. #[error("provider '{provider_ref}' not found in registry; register it with ProviderRegistry::register() before use")] ProviderNotFound { /// The provider reference that was looked up (e.g., "openai:gpt-4o"). provider_ref: String, }, /// A provider reference string is malformed. #[error("invalid provider reference '{input}': expected format 'namespace:model' (e.g., 'openai:gpt-4o')")] InvalidProviderRef { /// The malformed input string. input: String, }, /// JSON schema validation failed. #[error("schema validation failed at path '{path}': {reason}")] SchemaValidation { /// JSON pointer path to the failing field. path: String, /// Human-readable description of what was expected. reason: String, }, /// An invalid lifecycle state transition was attempted. /// /// See ANVIL Spec §5.1 — Lifecycle State Machine for valid transitions. #[error("invalid lifecycle transition from {from} to {to}: {reason} (see ANVIL Spec §5.1)")] InvalidLifecycleTransition { /// The current state. from: String, /// The attempted target state. to: String, /// Why this transition is invalid. reason: String, }, /// A tool invocation was denied due to insufficient capabilities. #[error("tool '{tool_name}' invocation denied: agent {agent_did} lacks capability '{required_capability}' in Arsenal ACT {act_id}")] ToolInvocationDenied { /// The tool that was being invoked. tool_name: String, /// The agent's DID. agent_did: String, /// The capability that was required but missing. required_capability: String, /// The ACT that was checked. act_id: String, }, /// A tool execution failed. #[error("tool '{tool_name}' execution failed: {reason}")] ToolExecutionFailed { /// The tool that failed. tool_name: String, /// What went wrong. reason: String, }, /// JSON serialization or deserialization failed. #[error("JSON error: {0}")] Json(#[from] serde_json::Error), /// A required configuration value is missing. #[error("missing configuration: {field} is required ({hint})")] MissingConfig { /// The configuration field name. field: String, /// A hint about where to set this value. hint: String, }, /// The stop condition limit was reached. #[error("generation stopped: {reason} (steps={steps}, tokens={tokens})")] StopConditionReached { /// Why generation was stopped. reason: String, /// Number of steps completed. steps: u32, /// Total tokens consumed. tokens: u64, }, /// A telemetry emission failed. Non-fatal but logged. #[error("telemetry emission failed: {reason}")] TelemetryError { /// What went wrong with telemetry. reason: String, }, /// The model does not support the requested operation. #[error("model '{model}' does not support {operation}")] UnsupportedOperation { /// The model identifier. model: String, /// The operation that was requested. operation: String, }, /// The provider exists but is not currently available. #[error("provider '{provider_ref}' is unavailable: {reason}")] ProviderUnavailable { /// The provider reference that could not be used. provider_ref: String, /// Human-readable unavailability reason. reason: String, }, /// Provider authentication failed. #[error("provider '{provider_ref}' authentication failed: {reason}")] ProviderAuthenticationFailed { /// The provider reference that failed authentication. provider_ref: String, /// Human-readable authentication failure reason. reason: String, }, /// The provider does not support a required runtime capability. #[error("provider '{provider_ref}' does not support runtime capability '{capability}'")] CapabilityUnsupported { /// The provider reference that was negotiated. provider_ref: String, /// The missing runtime capability. capability: String, }, /// Provider runtime negotiation failed. #[error("provider '{provider_ref}' negotiation failed: {reason}")] ProviderNegotiationFailed { /// The provider reference that was negotiated. provider_ref: String, /// Human-readable negotiation failure reason. reason: String, }, /// The provider session expired before the requested action could complete. #[error("provider '{provider_ref}' session '{session_id}' expired before the requested action completed")] ProviderSessionExpired { /// The provider reference for the expired session. provider_ref: String, /// The expired session identifier. session_id: String, }, /// The provider does not support interrupts. #[error("provider '{provider_ref}' does not support session interrupts")] ProviderInterruptUnsupported { /// The provider reference that lacks interrupt support. provider_ref: String, }, /// The provider does not support resuming sessions. #[error("provider '{provider_ref}' does not support session resume")] ProviderResumeUnsupported { /// The provider reference that lacks resume support. provider_ref: String, }, /// An internal error that should not occur in normal operation. #[error("internal error: {0}")] Internal(String), } Source line 187 pub type ForgeResult = Result;