apperror

package
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 1, 2026 License: AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ArgsOf

func ArgsOf(err error) map[string]string

func CauseOf

func CauseOf(err error) error

CauseOf is intentionally separate from errors.Unwrap: infrastructure errors are retained for boundary logging without becoming a domain-level contract.

func TypeURI

func TypeURI(code Code) string

Types

type Code

type Code string

Code is the stable machine identity shared by every transport. Client logic may branch on it; it must never branch on Detail or an underlying cause.

const (
	CodeCapabilityNotFound                       Code = "capability.not_found"
	CodeCapabilityApprovalRequired               Code = "capability.approval_required"
	CodeCapabilityOperationFailed                Code = "capability.operation_failed"
	CodeCapabilityRequestInvalid                 Code = "capability.request_invalid"
	CodeCapabilityAccessDenied                   Code = "capability.access_denied"
	CodeWorkspaceDependencyDiscoveryFailed       Code = "workspace_dependency.discovery_failed"
	CodeWorkspaceDependencyDefinitionUnavailable Code = "workspace_dependency.definition_unavailable"
	CodeWorkspaceDependencyDefinitionInvalid     Code = "workspace_dependency.definition_invalid"
	CodeWorkspaceDependencyCatalogUnavailable    Code = "workspace_dependency.catalog_unavailable"
	CodeBotNameTaken                             Code = "bot.name_taken"
	CodeBotNameInvalid                           Code = "bot.name_invalid"
	CodeBotAgentNotFound                         Code = "bot_agent.not_found"
	CodeBotAgentNameTaken                        Code = "bot_agent.name_taken"
	CodeBotAgentInvalidRuntime                   Code = "bot_agent.invalid_runtime"
	CodeBotAgentInvalidMetadata                  Code = "bot_agent.invalid_metadata"
	CodeBotAgentDefaultInUse                     Code = "bot_agent.default_in_use"
	CodeBotAgentUnavailable                      Code = "bot_agent.unavailable"
	CodeBotAgentProviderDirectRuntime            Code = "bot_agent.provider_direct_runtime"
	CodeChannelRuntimeUnavailable                Code = "channel.runtime_unavailable"
	CodeChannelVerificationFailed                Code = "channel.verification_failed"
	CodeAgentChatModelNotConfigured              Code = "agent.chat_model_not_configured"
	CodeChannelEnableFailed                      Code = "channel.enable_failed"
	CodeChannelWebhookEndpointInvalid            Code = "channel.webhook_endpoint_invalid"
	CodeChannelBindingRequired                   Code = "channel.binding_required"
	CodeNetworkProviderNotConfigured             Code = "network.provider_not_configured"
	CodeUserCannotRemoveSelf                     Code = "user.cannot_remove_self"
	CodeCompactionModelUnavailable               Code = "compaction.model_unavailable" // Deprecated: no longer returned; kept because it was published.
	CodeSettingsReasoningEffortInvalid           Code = "settings.reasoning_effort_invalid"
	CodeSettingsReasoningUnavailable             Code = "settings.reasoning_options_unavailable"
	CodeContextBudgetUnsatisfied                 Code = "context.budget_unsatisfied"
	CodeContextProtectedOverflow                 Code = "context.protected_overflow"
	CodeMediaReferenceUnavailable                Code = "media.reference_unavailable"
	CodeWorkspaceUnreachable                     Code = "workspace.unreachable"
	CodeWorkspaceTemplateBootstrapFailed         Code = "workspace.template_bootstrap_failed"
	CodeWorkspaceDisplayClipboardFailed          Code = "workspace.display_clipboard_failed"
	CodeWorkspaceDisplayClipboardTooLarge        Code = "workspace.display_clipboard_too_large"
	CodeWorkspaceDisplayPrepareFailed            Code = "workspace.display_prepare_failed"
	CodeWorkspaceImageNotFound                   Code = "workspace.image_not_found"
	CodeWorkspaceImageRegistryUnavailable        Code = "workspace.image_registry_unavailable"
	CodeWorkspaceDependencyNotFound              Code = "workspace_dependency.not_found"
	CodeWorkspaceDependencyRequestInvalid        Code = "workspace_dependency.request_invalid"
	CodeWorkspaceDependencyActionUnsupported     Code = "workspace_dependency.action_unsupported"
	CodeWorkspaceDependencyPlatformUnsupported   Code = "workspace_dependency.platform_unsupported"
	CodeWorkspaceDependencyBusy                  Code = "workspace_dependency.busy"
	CodeWorkspaceDependencyRequired              Code = "workspace_dependency.required"
	CodeWorkspaceDependencyPrerequisitesChanged  Code = "workspace_dependency.prerequisites_changed"
	CodeWorkspaceDependencyWorkspaceNotRunning   Code = "workspace_dependency.workspace_not_running"
	CodeWorkspaceDependencyWorkspaceMissing      Code = "workspace_dependency.workspace_missing"
	CodeWorkspaceDependencyRollbackUnavailable   Code = "workspace_dependency.rollback_unavailable"
	CodeWorkspaceDependencyOperationFailed       Code = "workspace_dependency.operation_failed"
	CodeWorkspaceDependencyOperationInterrupted  Code = "workspace_dependency.operation_interrupted"
	CodeProviderTemplateNotFound                 Code = "provider_template.not_found"
	CodeProviderTemplateDomainInvalid            Code = "provider_template.domain_invalid"
	CodeProviderTemplateDomainMismatch           Code = "provider_template.domain_mismatch"
	CodeProviderTemplateOperationFailed          Code = "provider_template.operation_failed"
	CodeProviderNameTaken                        Code = "provider.name_taken"
	CodeProviderCatalogUnavailable               Code = "provider.catalog_unavailable"
	CodeProviderCatalogSourceNotFound            Code = "provider.catalog_source_not_found"
	CodeProviderManagedReadonly                  Code = "provider.managed_readonly"
	CodeProviderTemplateRequestInvalid           Code = "provider_template.request_invalid"
	CodeSearchProviderTypeConflict               Code = "search_provider.type_conflict"
	CodeSearchProviderInvalidProvider            Code = "search_provider.invalid_provider"
	CodeConnectorRequestInvalid                  Code = "connector.request_invalid"
	CodeConnectorNotConfigured                   Code = "connector.not_configured"
	CodeConnectorNotFound                        Code = "connector.not_found"
	CodeConnectorConflict                        Code = "connector.conflict"
	CodeConnectorRequestRejected                 Code = "connector.request_rejected"
	CodeConnectorOAuthClientNotConfigured        Code = "connector.oauth_client_not_configured"
	CodeConnectorUpstreamUnavailable             Code = "connector.upstream_unavailable"
	CodeConnectorOperationFailed                 Code = "connector.operation_failed"
	CodeSkillBuiltinReadOnly                     Code = "skill.builtin_read_only"
	CodeSkillNameTaken                           Code = "skill.name_taken"
	CodeSkillSaveFailed                          Code = "skill.save_failed"
	CodeSkillRegistryReadOnly                    Code = "skill.registry_read_only"
	CodeSkillNameInvalid                         Code = "skill.name_invalid"
	CodeSkillNotFound                            Code = "skill.not_found"
	CodeSkillDirectoryShared                     Code = "skill.directory_shared"
	CodeTTSTextTooLong                           Code = "tts.text_too_long"
	CodeTTSModelNotConfigured                    Code = "tts.model_not_configured"
	CodeWorkspaceArchiveInvalid                  Code = "workspace.archive_invalid"
	CodeBotBackupBundleInvalid                   Code = "bot_backup.bundle_invalid"
	CodeFetchProviderNativeManaged               Code = "fetch_provider.native_managed"
	CodeAppNotFound                              Code = "app.not_found"
	CodeAppRequestInvalid                        Code = "app.request_invalid"
	CodeAppBusy                                  Code = "app.busy"
	CodeAppOperationFailed                       Code = "app.operation_failed"
	CodeAppDependenciesUnavailable               Code = "app.dependencies_unavailable"
	CodeAppPrerequisiteFailed                    Code = "app.prerequisite_failed"
	CodeRegistryUnavailable                      Code = "registry.unavailable"
	CodeRegistryAppNotFound                      Code = "registry.app_not_found"
	CodeRegistryAppInvalid                       Code = "registry.app_invalid"
	CodeRegistryAppInstallFailed                 Code = "registry.app_install_failed"
	CodeProfileRequestInvalid                    Code = "profile.request_invalid"
	CodeProfileTitleModelInvalid                 Code = "profile.title_model_invalid"
	CodeProfileUpdateFailed                      Code = "profile.update_failed"
	CodeACPRequestInvalid                        Code = "acp.request_invalid"
	CodeACPAccessForbidden                       Code = "acp.access_forbidden"
	CodeACPRuntimeNotFound                       Code = "acp.runtime_not_found"
	CodeACPRuntimeConflict                       Code = "acp.runtime_conflict"
	CodeACPOperationFailed                       Code = "acp.operation_failed"
	CodeACPCommandNotFound                       Code = "acp.command_not_found"
	CodeExternalAgentTurnReplacementUnsupported  Code = "external_agent.turn_replacement_unsupported"
	CodeACPModelSelectionUnsupported             Code = "acp.model_selection_unsupported"
	CodeACPModelIDRequired                       Code = "acp.model_id_required"
	CodeACPModelUnavailable                      Code = "acp.model_unavailable"
	CodeACPReasoningUnsupported                  Code = "acp.reasoning_selection_unsupported"
	CodeACPReasoningEffortRequired               Code = "acp.reasoning_effort_required"
	CodeACPReasoningUnavailable                  Code = "acp.reasoning_effort_unavailable"
	CodeACPModeSelectionUnsupported              Code = "acp.mode_selection_unsupported"
	CodeACPModeIDRequired                        Code = "acp.mode_id_required"
	CodeACPModeUnavailable                       Code = "acp.mode_unavailable"
	CodeACPConfigUpdateFailed                    Code = "acp.config_update_failed"
	CodeRuntimeControlUnsupported                Code = "runtime_control.unsupported"
	CodeRuntimeControlCommandUnavailable         Code = "runtime_control.command_unavailable"
	CodeRuntimeControlModeUnavailable            Code = "runtime_control.mode_unavailable"
	CodeRuntimeControlGoalRequiresDefaultMode    Code = "runtime_control.goal_requires_default_mode"
	CodeWorkdirGitBusy                           Code = "workdir.git_busy"
	CodeWorkdirGitBranchUnavailable              Code = "workdir.git_branch_unavailable"
	CodeWorkdirGitSwitchFailed                   Code = "workdir.git_switch_failed"
	CodeWorkdirGitUnavailable                    Code = "workdir.git_unavailable"
	CodeWorkdirRemoteUnsupportedForAgent         Code = "workdir.remote_unsupported_for_agent"
	CodeChatMessageEmpty                         Code = "chat.message_empty"
	CodeRuntimeControlThreadUnavailable          Code = "runtime_control.thread_unavailable"
	CodeRuntimeControlCancelled                  Code = "runtime_control.cancelled"
	CodeRuntimeControlForkLatestOnly             Code = "runtime_control.fork_latest_only"
	CodeExternalRuntimeBusy                      Code = "external_runtime.busy"
	CodeRuntimeControlFailed                     Code = "runtime_control.failed"
	CodeRuntimeControlSteerFailed                Code = "runtime_control.steer_failed"
	CodeRuntimeControlForbidden                  Code = "runtime_control.forbidden"
	CodeRuntimeControlRequestInvalid             Code = "runtime_control.request_invalid"
	CodeExternalRuntimeAuthRequired              Code = "external_runtime.auth_required"
	CodeExternalRuntimeUnavailable               Code = "external_runtime.unavailable"
	CodeExternalRuntimeSessionResumeFailed       Code = "external_runtime.session_resume_failed"
	CodeExternalRuntimeUsageLimited              Code = "external_runtime.usage_limited"
	CodeExternalRuntimeRateLimited               Code = "external_runtime.rate_limited"
	CodeExternalRuntimeContextWindowExceeded     Code = "external_runtime.context_window_exceeded"
	CodeExternalRuntimeOverloaded                Code = "external_runtime.overloaded"
	CodeExternalRuntimeUpstreamUnreachable       Code = "external_runtime.upstream_unreachable"
	CodeExternalRuntimeRequestBlocked            Code = "external_runtime.request_blocked"
	CodeExternalRuntimeReported                  Code = "external_runtime.reported"
	CodeToolApprovalForbidden                    Code = "tool_approval.forbidden"
	CodeToolApprovalNotFound                     Code = "tool_approval.not_found"
	CodeToolApprovalExpired                      Code = "tool_approval.expired"
	CodeToolApprovalAmbiguous                    Code = "tool_approval.ambiguous"
	CodeToolApprovalRequestInvalid               Code = "tool_approval.request_invalid"
	CodeToolApprovalOperationFailed              Code = "tool_approval.operation_failed"
	CodeUserInputForbidden                       Code = "user_input.forbidden"
	CodeUserInputExpired                         Code = "user_input.expired"
	CodeUserInputOperationFailed                 Code = "user_input.operation_failed"
	CodeSessionModelPreferenceConflict           Code = "session.model_preference_conflict"
	CodeSessionBusy                              Code = "session_runtime.session_busy"
	CodeSessionInvocationConflict                Code = "session_runtime.invocation_conflict"
	CodeSessionHistoryInconsistent               Code = "session_runtime.history_inconsistent"
	CodeSessionTurnNotLatest                     Code = "session_runtime.turn_not_latest"
	CodeSessionTurnIncomplete                    Code = "session_runtime.turn_incomplete"
	CodeSessionTurnNotFound                      Code = "session_runtime.turn_not_found"
	CodeSessionResetUnavailable                  Code = "session_runtime.reset_unavailable"
	CodeSessionResetConflict                     Code = "session_runtime.reset_conflict"
	CodeHistoryDeleteFailed                      Code = "history.delete_failed"
	CodeHookUserMessageFailed                    Code = "hook.user_message_failed"
	CodeSessionPublishFailed                     Code = "session_runtime.publish_failed"
	CodeSessionAbortFailed                       Code = "session_runtime.abort_failed"
	CodeAgentResponseTimeout                     Code = "agent.response_timeout"
	CodeSessionInterrupted                       Code = "session_runtime.interrupted"
	CodeAgentToolTimeout                         Code = "agent.tool_timeout"
	CodeVideoJobOutcomeUnknown                   Code = "video.job_outcome_unknown"
	CodeScheduleExecutionTimeout                 Code = "schedule.execution_timeout"
	CodeScheduleRunTargetConflict                Code = "schedule.run_target_conflict"
	CodeScheduleModelConflict                    Code = "schedule.model_conflict"
	CodeScheduleModelUnusable                    Code = "schedule.model_unusable"
	CodeScheduleModelRequired                    Code = "schedule.model_required"
	CodeScheduleSessionModeUnsupported           Code = "schedule.session_mode_unsupported"
	CodeScheduleNotFound                         Code = "schedule.not_found"
	CodeAgentResponseInterrupted                 Code = "agent.response_interrupted"
	CodeAgentProviderOverloaded                  Code = "agent.provider_overloaded"
	CodeAgentProviderRateLimited                 Code = "agent.provider_rate_limited"
	CodeAgentProviderQuotaExhausted              Code = "agent.provider_quota_exhausted"
	CodeAgentProviderAuthFailed                  Code = "agent.provider_auth_failed"
	CodeAgentProviderPermissionDenied            Code = "agent.provider_permission_denied"
	CodeAgentProviderRequestRejected             Code = "agent.provider_request_rejected"
	CodeAgentProviderUnreachable                 Code = "agent.provider_unreachable"
	CodeQueueNoActiveRun                         Code = "queue_no_active_run"
	CodeQueueAdmissionOverloaded                 Code = "queue_admission_overloaded"
	CodeQueueAdmissionUnavailable                Code = "queue_admission_unavailable"
	CodeQueueRequestInvalid                      Code = "queue_request_invalid"
	CodeQueueItemNotPending                      Code = "queue_item_not_pending"
	CodeQueueItemNotEditable                     Code = "queue_item_not_editable"

	// Runtime notices: degradations an external agent runtime reports into the
	// conversation (event.RuntimeNotice). Clients localize them from errors.*.
	CodeRuntimeNativeHistoryLost   Code = "native_history_lost"
	CodeRuntimeToolsUnavailable    Code = "tools_unavailable"
	CodeRuntimeElicitationDeclined Code = "elicitation_declined"
	CodeRuntimeOutputTruncated     Code = "output_truncated"
	CodeQueueCapacityExceeded      Code = "queue_capacity_exceeded"
	CodeQueueSteerUnsupported      Code = "queue.steer_unsupported"

	CodeContextLifecycleRequestInvalid         Code = "context_lifecycle.request_invalid"
	CodeContextLifecycleAuthenticationRequired Code = "context_lifecycle.authentication_required"
	CodeContextLifecycleAccessDenied           Code = "context_lifecycle.access_denied"
	CodeContextLifecycleNotFound               Code = "context_lifecycle.not_found"
	CodeContextLifecycleLoadFailed             Code = "context_lifecycle.load_failed"
	CodeAgentAuthorizationExpired              Code = "agent_authorization.expired"
	CodeAgentAuthorizationNotReady             Code = "agent_authorization.not_ready"
	CodeAgentAuthorizationLimit                Code = "agent_authorization.limit"
	CodeAgentAuthorizationFailed               Code = "agent_authorization.failed"
	CodeAgentAuthorizationCodeInvalid          Code = "agent_authorization.code_invalid"
	CodeAgentCredentialNotFound                Code = "agent_credential.not_found"                //nolint:gosec // Stable public error code.
	CodeAgentCredentialRequestInvalid          Code = "agent_credential.request_invalid"          //nolint:gosec // Stable public error code.
	CodeAgentCredentialForbidden               Code = "agent_credential.forbidden"                //nolint:gosec // Stable public error code.
	CodeAgentCredentialIncompatible            Code = "agent_credential.incompatible"             //nolint:gosec // Stable public error code.
	CodeAgentCredentialRevoked                 Code = "agent_credential.revoked"                  //nolint:gosec // Stable public error code.
	CodeAgentCredentialReauthRequired          Code = "agent_credential.reauthorization_required" //nolint:gosec // Stable public error code.
	CodeAgentCredentialEncryptionUnavailable   Code = "agent_credential.encryption_unavailable"   //nolint:gosec // Stable public error code.
	CodeAgentCredentialRuntimeBusy             Code = "agent_credential.runtime_busy"             //nolint:gosec // Stable public error code.
	CodeAgentCredentialMaterializationFailed   Code = "agent_credential.materialization_failed"   //nolint:gosec // Stable public error code.
	CodeAgentCredentialUsageUnavailable        Code = "agent_credential.usage_unavailable"        //nolint:gosec // Stable public error code.

	// Boundary codes for failures that carry no public error of their own:
	// an unclassified failure and a request the caller canceled.
	CodeInternal Code = "internal"
	CodeCanceled Code = "canceled"

	// Framework codes: the HTTP boundary answers a transport-level
	// *echo.HTTPError (routing, method, body limit, binding) with the code for
	// its status.
	CodeHTTPBadRequest           Code = "http.bad_request"
	CodeHTTPUnauthorized         Code = "http.unauthorized"
	CodeHTTPForbidden            Code = "http.forbidden"
	CodeHTTPNotFound             Code = "http.not_found"
	CodeHTTPMethodNotAllowed     Code = "http.method_not_allowed"
	CodeHTTPConflict             Code = "http.conflict"
	CodeHTTPPayloadTooLarge      Code = "http.payload_too_large"
	CodeHTTPUnsupportedMediaType Code = "http.unsupported_media_type"
	CodeHTTPUpgradeRequired      Code = "http.upgrade_required"
	CodeHTTPTooManyRequests      Code = "http.too_many_requests"
	CodeHTTPNotImplemented       Code = "http.not_implemented"
	CodeHTTPBadGateway           Code = "http.bad_gateway"
	CodeHTTPServiceUnavailable   Code = "http.service_unavailable"
	CodeHTTPGatewayTimeout       Code = "http.gateway_timeout"

	// Request field codes: a request that lacks a field or carries an invalid
	// value in one, named in the field arg as the request names it.
	CodeRequestFieldRequired Code = "request.field_required"
	CodeRequestFieldInvalid  Code = "request.field_invalid"

	CodeSessionNotFound Code = "session.not_found"

	// Resources a request named that do not exist (or no longer exist).
	CodeBotNotFound                   Code = "bot.not_found"
	CodeBotAccessGrantNotFound        Code = "bot_access.grant_not_found"
	CodeChannelConfigNotFound         Code = "channel.config_not_found"
	CodeChannelIdentityConfigNotFound Code = "channel.identity_config_not_found"
	CodeChannelRouteNotFound          Code = "channel_route.not_found"
	CodeBrowserSessionNotFound        Code = "browser.session_not_found"
	CodeDisplaySessionNotFound        Code = "display.session_not_found"
	CodeFetchProviderNotFound         Code = "fetch_provider.not_found"
	CodeSearchProviderNotFound        Code = "search_provider.not_found"
	CodeWorkspaceFileNotFound         Code = "workspace_file.not_found"
	CodeMCPConnectionNotFound         Code = "mcp.connection_not_found"
	CodeMediaAssetNotFound            Code = "media.asset_not_found"
	CodeMessageNotFound               Code = "message.not_found"
	CodeModelNotFound                 Code = "model.not_found"
	CodeProviderNotFound              Code = "provider.not_found"
	CodeTTSProviderNotFound           Code = "tts_provider.not_found"
	CodeTTSModelNotFound              Code = "tts_model.not_found"
	CodeTranscriptionModelNotFound    Code = "transcription_model.not_found"
	CodeVideoProviderNotFound         Code = "video_provider.not_found"
	CodeVideoModelNotFound            Code = "video_model.not_found"
	CodeUserNotFound                  Code = "user.not_found"
	CodeUserRuntimeNotFound           Code = "user_runtime.not_found"
	CodeWorkdirNotFound               Code = "workdir.not_found"
	CodeWorkspaceTargetNotFound       Code = "workspace_target.not_found"
	CodeSupermarketNotFound           Code = "supermarket.not_found"

	// MCP connection codes, and the OAuth state code that MCP shares with
	// provider sign-in.
	CodeMCPEndpointInvalid       Code = "mcp.endpoint_invalid"
	CodeMCPNameTaken             Code = "mcp.name_taken"
	CodeMCPOAuthDiscoveryFailed  Code = "mcp.oauth_discovery_failed"
	CodeMCPOAuthNotDiscovered    Code = "mcp.oauth_not_discovered"
	CodeMCPOAuthClientIDRequired Code = "mcp.oauth_client_id_required"
	CodeOAuthStateInvalid        Code = "oauth.state_invalid"

	// External Agent codes. They keep the values the removed agent feedback
	// protocol published and history rows still store.
	CodeACPAgentNotFound            Code = "acp_agent_not_found"
	CodeACPAgentNotEnabled          Code = "acp_agent_not_enabled"
	CodeACPAgentNotConfigured       Code = "acp_agent_not_configured"
	CodeACPAgentAuthInvalid         Code = "acp_agent_auth_invalid"
	CodeNoWorkspaceExec             Code = "no_workspace_exec"
	CodeACPRuntimeOwnerMissing      Code = "acp_runtime_owner_missing"
	CodeACPDiscussUnsupported       Code = "acp_discuss_unsupported"
	CodeGroupChatACPUnsupported     Code = "group_chat_acp_unsupported"
	CodeACPProjectModeInvalid       Code = "acp_project_mode_invalid"
	CodeACPProjectPathInvalid       Code = "acp_project_path_invalid"
	CodeACPDisplayArgsInvalid       Code = "acp_display_args_invalid"
	CodeACPRuntimeStartFailed       Code = "acp_runtime_start_failed"
	CodeACPRuntimeBusy              Code = "acp_runtime_busy"
	CodeACPAttachmentInvalid        Code = "acp_attachment_invalid"
	CodeACPAttachmentUnavailable    Code = "acp_attachment_unavailable"
	CodeRuntimeAgentCommandStale    Code = "runtime_agent_command_stale"
	CodeACPImageInputUnsupported    Code = "acp_image_input_unsupported"
	CodeInvalidChatRuntime          Code = "invalid_chat_runtime"
	CodeAgentDependencyMissing      Code = "agent_dependency_missing"
	CodeExternalAgentAccountUnbound Code = "external_agent.account_unbound"
	// A direct runtime (Codex, Claude Code) was asked to start in a workspace
	// that is not a container.
	CodeExternalAgentContainerWorkspaceRequired Code = "external_agent.container_workspace_required"

	// Run error codes persisted in session_runs.error_code and history
	// metadata. The writers keep their own constants; these register the same
	// values.
	CodeRuntimeRunFailed             Code = "runtime_run_failed"
	CodeRuntimePromptFailed          Code = "runtime_prompt_failed"
	CodeRuntimeOwnerLeaseExpired     Code = "runtime_owner_lease_expired"
	CodeRuntimeLiveBackendLost       Code = "runtime_live_backend_lost"
	CodeRuntimeAdmissionOrphaned     Code = "runtime_admission_orphaned"
	CodeRuntimeFenceActivationFailed Code = "runtime_fence_activation_failed"
	CodeRuntimeReservationFailed     Code = "runtime_reservation_failed"
	CodeRuntimeReservationDeclined   Code = "runtime_reservation_declined"
	CodeHistoryReset                 Code = "history_reset"

	// Channel queue command codes (internal/channel/inbound/queue_command.go).
	CodeQueueInvocationConflict         Code = "queue_invocation_conflict"
	CodeQueueUnsupportedSession         Code = "queue_unsupported_session"
	CodeQueueFollowUpUnsupportedChannel Code = "queue_follow_up_unsupported_channel"
	// Reasons recorded on a rejected live queue item, registered under the
	// value the queue state stores (internal/agent/runtime/session/live_queue.go).
	CodeQueueTargetRunNotActive     Code = "queue_target_run_not_active"
	CodeQueueFollowUpCommandInvalid Code = "queue_follow_up_command_invalid"

	// Slash request refusals (internal/slash), on the Web composer and in IM
	// channels alike.
	CodeSlashAttachmentsUnsupported     Code = "slash.attachments_unsupported"
	CodeSlashPermissionDenied           Code = "slash.permission_denied"
	CodeSlashRequiresWebSocket          Code = "slash.requires_websocket"
	CodeSlashReservedMetadata           Code = "slash.reserved_metadata"
	CodeSlashSkillActivationUnsupported Code = "slash.skill_activation_unsupported"
	CodeSlashSkillAmbiguous             Code = "slash.skill_ambiguous"
	CodeSlashSkillContextTooLarge       Code = "slash.skill_context_too_large"
	CodeSlashSkillDisabled              Code = "slash.skill_disabled"
	CodeSlashSkillNotFound              Code = "slash.skill_not_found"
	CodeSlashSkillNotUsable             Code = "slash.skill_not_usable"
	CodeSlashSkillSyntaxInvalid         Code = "slash.skill_syntax_invalid"
	CodeSlashTooManySkills              Code = "slash.too_many_skills"
	CodeSlashUnknownCommand             Code = "slash.unknown_command"
	CodeSlashUnsupportedInWeb           Code = "slash.unsupported_in_web"

	CodeMemoryCompactUnsupported Code = "memory.compact_unsupported"

	// Bot and workspace codes published by the workspace HTTP handlers and the
	// bot creation, display and dependency event streams.
	CodeBotReadyUpdateFailed                    Code = "bot_ready_update_failed"
	CodeWorkspaceSetupTimeout                   Code = "workspace_setup_timeout"
	CodeWorkspaceSetupFailed                    Code = "workspace_setup_failed"
	CodeWorkspaceDisplayDisabled                Code = "workspace_display_disabled"
	CodeWorkspaceDependencyOperationUnknown     Code = "workspace_dependency_operation_unknown"
	CodeWorkspaceCreateRequestInvalid           Code = "workspace_create_request_invalid"
	CodeWorkspaceCreateFailed                   Code = "workspace_create_failed"
	CodeWorkspaceNotFound                       Code = "workspace_not_found"
	CodeWorkspaceLoadFailed                     Code = "workspace_load_failed"
	CodeWorkspaceMetricsLoadFailed              Code = "workspace_metrics_load_failed"
	CodeWorkspaceResourceLimitsInvalid          Code = "workspace_resource_limits_invalid"
	CodeWorkspaceResourceLimitsRequired         Code = "workspace_resource_limits_required"
	CodeWorkspaceResourceLimitsSaveFailed       Code = "workspace_resource_limits_save_failed"
	CodeWorkspaceDeleteFailed                   Code = "workspace_delete_failed"
	CodeWorkspaceTeardownFailed                 Code = "workspace.teardown_failed"
	CodeWorkspaceStartFailed                    Code = "workspace_start_failed"
	CodeWorkspaceStopFailed                     Code = "workspace_stop_failed"
	CodeWorkspaceSnapshotsUnsupported           Code = "workspace_snapshots_unsupported"
	CodeWorkspaceSnapshotManagerUnavailable     Code = "workspace_snapshot_manager_unavailable"
	CodeWorkspaceSnapshotRequestInvalid         Code = "workspace_snapshot_request_invalid"
	CodeWorkspaceSnapshotCreateFailed           Code = "workspace_snapshot_create_failed"
	CodeWorkspaceSnapshotsLoadFailed            Code = "workspace_snapshots_load_failed"
	CodeWorkspaceSnapshotterMismatch            Code = "workspace_snapshotter_mismatch"
	CodeWorkspaceSnapshotChainNotFound          Code = "workspace_snapshot_chain_not_found"
	CodeWorkspaceManagerUnavailable             Code = "workspace_manager_unavailable"
	CodeWorkspaceSnapshotRollbackRequestInvalid Code = "workspace_snapshot_rollback_request_invalid"
	CodeWorkspaceSnapshotVersionInvalid         Code = "workspace_snapshot_version_invalid"
	CodeWorkspaceSnapshotRollbackFailed         Code = "workspace_snapshot_rollback_failed"
	CodeWorkspacePreservedDataNotFound          Code = "workspace_preserved_data_not_found"
	CodeWorkspaceRestoreFailed                  Code = "workspace_restore_failed"
)

func CodeOf

func CodeOf(err error) Code

type Definition

type Definition struct {
	HTTPStatus  int
	Detail      string
	AllowedArgs []string
	// Fault is the attribution of the code when the status alone would give
	// the wrong one, as for a provider's 429 or 502. Empty leaves it to the
	// error chain: a 4xx status is a client fault, and a 5xx status is this
	// process's fault unless its cause is marked as a dependency's.
	Fault Fault
}

Definition is the single catalog entry for a public error contract. Type URIs and frontend i18n keys are derived mechanically from Code.

func Lookup

func Lookup(code Code) (Definition, bool)

type Error

type Error struct {
	// contains filtered or unexported fields
}

Error keeps the public contract separate from private diagnostics. The cause is intentionally not exposed through Unwrap; transport boundaries may log it through CauseOf without making infrastructure details part of the API.

func As

func As(err error) (*Error, bool)

func FieldInvalid added in v0.22.0

func FieldInvalid(field string, cause error) *Error

FieldInvalid is the answer to a request whose field holds a value this process cannot accept; cause says why and stays private. field is named as for FieldRequired.

func FieldRequired added in v0.22.0

func FieldRequired(field string) *Error

FieldRequired is the answer to a request that lacks field. field is the name the request uses for it: the JSON key, query parameter or path parameter, as written there, with dots for a nested key.

func New

func New(code Code, args map[string]string) *Error

New creates a public application error without an infrastructure cause.

func Wrap

func Wrap(code Code, cause error, args map[string]string) *Error

Wrap retains a private cause for boundary logging. Only catalog-allowed args are kept for serialization.

func (*Error) Cause added in v0.21.0

func (e *Error) Cause() error

Cause returns the private cause for diagnostic traversal. The errs package walks Cause() as well as Unwrap to find the origin, stack and attributes of a failure. Error deliberately has no Unwrap: errors.Is and errors.As stop at a public error, so code above it cannot branch on what it wraps.

func (*Error) Error

func (e *Error) Error() string

type Fault added in v0.21.0

type Fault string

Fault is who a failure is attributed to. The values are the fault values of the error contract: the fault field of a Problem and the fault metadata of an RPC ErrorInfo. A catalog entry may declare client, server or dependency; canceled is attributed at a boundary from the caller's context and is never declared.

const (
	// FaultClient means the caller's request was refused by this process's
	// rules; the caller must change the request.
	FaultClient Fault = "client"
	// FaultServer means this process failed: its code, data or configuration,
	// including a bad request this process sent downstream.
	FaultServer Fault = "server"
	// FaultDependency means a service outside this process failed or refused
	// the call, such as an LLM provider, an external agent runtime, an
	// internal downstream service or the network.
	FaultDependency Fault = "dependency"
	// FaultCanceled means the caller canceled, or the caller's deadline passed.
	FaultCanceled Fault = "canceled"
)

func ParseFault added in v0.22.0

func ParseFault(s string) (Fault, bool)

ParseFault reads a fault value received as a string, such as the fault metadata of an RPC ErrorInfo. It reports false for any other string.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL