Skip to content

Error codes

DeepIntShield SDK errors expose a stable machine-readable code and a trusted description. Branch on error.code or ErrorCode, not exception text or a gateway response message.

from deepintshield import DeepintShieldError, ErrorCode
try:
result = shield.guard(stage="input", input="Transfer the funds")
except DeepintShieldError as error:
if error.code == ErrorCode.RATE_LIMITED.value:
schedule_retry(error)
elif error.code == ErrorCode.GUARDRAIL_BLOCKED.value:
return safe_refusal(error.description)
else:
log.error(
"DeepIntShield operation failed",
extra={
"code": error.code,
"status_code": error.status_code,
"retryable": error.retryable,
},
)
raise

The following names are importable from deepintshield:

from deepintshield import (
ERROR_CATALOG,
DeepintShieldBlockedError,
DeepintShieldError,
ErrorCategory,
ErrorCode,
ErrorDefinition,
get_error_definition,
get_exception_error_code,
iter_error_definitions,
)

DeepintShieldError preserves the original constructor and adds keyword-only structured metadata:

DeepintShieldError(
message,
status_code=None,
payload=None,
*,
code=None,
details=None,
)
FieldUse
codeStable lowercase identifier for program logic.
descriptionCatalog-controlled, display-safe summary.
retryableCatalog hint; your application still decides whether and how to retry.
detailsStructured caller/request context such as status_code, stage, or the bounded original response_code. Review it before displaying or logging it.
status_codeHTTP status when the failure came from a gateway response.
messageRaw diagnostic text. Treat it as untrusted and potentially sensitive.
payloadRaw gateway payload. Keep it out of user responses and unprotected logs.

error.to_dict() returns only code, description, status_code, retryable, and a copy of details. It intentionally omits raw message and payload, but details can still contain caller/request diagnostic data and is not universally sanitized. DeepintShieldBlockedError defaults to guardrail_blocked and also exposes its guardrail stage and decision metadata.

Some SDK paths preserve the exception type callers already expect and annotate the instance with code, description, retryable, and details:

BoundaryPreserved type examples
Network/timeouthttpx.HTTPError, httpx.TimeoutException
Optional provider/framework dependencyImportError
Invalid environment valueValueError
Unsupported RAG wrapper targetTypeError
Unknown framework binder or operationValueError, AttributeError
Agentic application boundaryPermissionError, ConnectionError, RuntimeError

These are not subclasses of DeepintShieldError. Catch the narrow native type appropriate to the operation, then use get_exception_error_code(error) to read its SDK annotation. Do not catch every ImportError or ValueError in a large block and assume it came from DeepIntShield; an empty helper result means the exception has no recognized SDK contract.

from deepintshield import ErrorCategory, get_error_definition, iter_error_definitions
definition = get_error_definition("rate-limited") # hyphens normalize to underscores
if definition:
print(definition.description)
print(definition.retryable)
print(definition.action)
print(definition.dashboard_path)
for definition in iter_error_definitions(ErrorCategory.MCP):
print(definition.code, definition.description)

ERROR_CATALOG is an immutable mapping and each ErrorDefinition is frozen. Lookup is an in-memory O(1) mapping operation; iteration is deterministic. These catalog operations perform no network or filesystem I/O. That local property is not an end-to-end latency guarantee for the SDK operation that produced an error.

An unknown code returns None; an unknown category returns an empty tuple. Keep a generic fallback so applications remain compatible when a newer SDK adds a code.

Framework boundaries retain conventional Python exception types:

  • PermissionError means the operation was denied.
  • ConnectionError means the Agentic gateway or its response was unusable.
  • RuntimeError covers approvals, configuration, dependencies, registration, and blueprint lifecycle stops.

Use get_exception_error_code() to read their safe marker. It also works with DeepintShieldError and does not expose the SDK’s private compatibility attribute:

from deepintshield import get_error_definition, get_exception_error_code
try:
governed_tool()
except (PermissionError, ConnectionError, RuntimeError) as error:
code = get_exception_error_code(error)
definition = get_error_definition(code)
if definition is None:
raise
log.warning(
definition.description,
extra={"code": code, "retryable": definition.retryable},
)

Malformed values and ordinary exception prose produce an empty string. A bounded, future Agentic code may be returned before the local catalog recognizes it, so always handle definition is None.

For an HTTP failure, the SDK resolves the stable code in this order:

  1. An explicit SDK code= override.
  2. A recognized code in error.code, top-level code, error_code, or a code-shaped string in error.
  3. A semantic status mapping: 401authentication_failed, 402feature_locked, 403permission_denied, 404resource_not_found, 408transport_timeout, 409conflict, and 429rate_limited.
  4. The feature-specific fallback supplied by the SDK surface.
  5. server_error for remaining 5xx responses, otherwise http_error.

Codes are lowercased and hyphens become underscores. Common gateway aliases normalize as follows:

Gateway aliasStable SDK code
unauthenticated, authentication_error, unauthorizedauthentication_failed
forbiddenpermission_denied
not_foundresource_not_found
rate_limit_exceeded, too_many_requestsrate_limited

An unknown response code cannot replace the stable generic error.code. When it matches the bounded code grammar, it remains available as error.details["response_code"] for diagnosis.

retryable=True means the failure may be transient; it does not mean the SDK automatically retries or that replaying the operation is safe.

  • Retry only idempotent operations, or use your own idempotency key.
  • Apply capped exponential backoff with jitter and honor Retry-After when the gateway provides it.
  • Bound attempts with a deadline and circuit breaker.
  • Do not automatically retry denials, validation errors, approval-required outcomes, quota failures, or incomplete registration/blueprint states.
  • Treat Agentic failures as fail-closed. Restore the indicated service or complete the dashboard workflow before retrying.
  • Test timeout, rate-limit, partial-response, and concurrency behavior under the traffic and provider mix you operate.

Error-code string values and their meanings are compatibility contracts. Existing values are not repurposed; future releases may add values. Categories, descriptions, operator actions, and dashboard paths are catalog metadata and may be clarified without changing the code’s meaning. Persist the code for durable automation and observability, not the English description.

The tables below list every code in the current SDK catalog. “Retryable” is the catalog hint described above, not permission to replay a non-idempotent action.

CodeDescriptionRetryable
sdk_errorThe DeepIntShield SDK operation failed.No
client_closedThe DeepIntShield client has already been closed.No
CodeDescriptionRetryable
configuration_errorThe SDK configuration is invalid or incomplete.No
virtual_key_missingAn active workspace Virtual Key is required.No
optional_dependency_missingA required optional dependency is not installed.No
feature_lockedThis feature is not enabled for the workspace.No
CodeDescriptionRetryable
transport_errorThe gateway could not be reached.Yes
transport_timeoutThe gateway request timed out.Yes
http_errorThe gateway rejected the request.No
invalid_responseThe gateway returned an invalid response.Yes
authentication_failedGateway authentication failed.No
permission_deniedThe requested gateway operation is not permitted.No
resource_not_foundThe requested gateway resource was not found.No
conflictThe request conflicts with the current gateway state.No
rate_limitedThe gateway rate limit was exceeded.Yes
quota_exceededThe workspace quota was exceeded.No
server_errorThe gateway failed to process the request.Yes
internal_errorThe gateway encountered an internal error.Yes
CodeDescriptionRetryable
chat_request_failedThe chat completion request failed.No
chat_stream_invalid_eventThe chat stream returned a malformed event.No
CodeDescriptionRetryable
guardrail_evaluation_failedThe guardrail evaluation failed.No
guardrail_blockedA guardrail blocked the operation.No
CodeDescriptionRetryable
rag_evaluation_failedThe RAG security evaluation failed.No
rag_retriever_unsupportedThe retriever exposes no supported retrieval method.No
rag_embedder_unsupportedThe embedder exposes no supported embedding method.No
CodeDescriptionRetryable
agent_invocation_invalidThe tool invocation is incomplete or invalid.No
CodeDescriptionRetryable
mcp_dependency_missingA supported official MCP Python SDK is not available.No
mcp_connection_failedThe MCP server connection failed.No
mcp_protocol_errorThe MCP server returned an invalid protocol response.No
mcp_execution_failedThe MCP tool execution failed.No
mcp_discovery_failedMCP tool discovery failed.No
mcp_tool_name_invalidThe MCP tool name is not qualified with a server prefix.No
mcp_arguments_invalidThe MCP tool arguments are not valid JSON.No
mcp_tool_authorization_deniedCanonical Agentic authorization denied the MCP tool execution.No
mcp_tool_authorization_unavailableCanonical Agentic authorization for the MCP tool is unavailable.Yes
mcp_tool_approval_requiredThe MCP tool execution is waiting for approval.No
CodeDescriptionRetryable
provider_dependency_missingThe selected provider dependency is not installed.No
provider_initialization_failedThe selected provider could not be initialized.No
CodeDescriptionRetryable
framework_binder_not_foundThe requested framework binder is not supported.No
framework_binder_attribute_missingThe framework does not provide the requested binder operation.No
framework_dependency_missingThe selected agent framework dependency is missing.No
framework_integration_unsupportedThe installed agent framework version is not supported.No
CodeDescriptionRetryable
invalid_argumentA request argument is invalid.No
validation_errorSDK input validation failed.No
CodeDescriptionRetryable
agentic_errorThe governed operation stopped safely.No
governance_configuration_errorAgent governance is not fully configured.No
guardrail_deniedAgentic authorization denied this operation.No
require_approvalThis operation is waiting for approval.No
mask_obligation_unsupportedA required data-protection obligation could not be applied safely.No
gateway_unavailableThe Agentic gateway is unavailable.Yes
invalid_gateway_responseThe Agentic gateway returned an invalid response.Yes
agent_registration_pendingThis agent is waiting for registration approval.No
agent_not_registeredThis agent is not registered.No
agent_registration_deniedThis agent’s registration was denied.No
agent_registration_not_readyThis agent’s registration review is incomplete.No
agent_registration_approval_requiredThis agent requires registration approval.No
agent_registration_quota_exceededThis reporting key has reached its pending-registration limit.No
agent_registration_review_staleThe agent registration changed during review.No
agent_registration_review_conflictThe agent registration changed during review.No
agent_approval_pendingThis operation is waiting for approval.No
guardrail_approval_pendingThis operation is waiting for approval.No
approval_requiredThis operation is waiting for approval.No
approval_access_deniedYou are not allowed to review this approval.No
approval_store_unavailableThe durable approval service is unavailable.Yes
authz_store_unavailableThe authorization service is unavailable.Yes
legacy_pdp_unavailableThe configured policy decision service is unavailable.Yes
agent_blueprint_review_pendingThis code blueprint is waiting for security review.No
agent_blueprint_review_deniedThis code blueprint was denied.No
blueprint_scan_unavailableThe code blueprint could not be scanned safely.Yes
blueprint_scan_requiredAn approved code blueprint is required.No
blueprint_scanning_requiredStatic code-blueprint scanning must remain enabled.No
blueprint_registration_failedThe code blueprint could not be registered safely.Yes
blueprint_coverage_incompleteThe executable code evidence is incomplete.No
blueprint_manifest_too_largeThe executable code blueprint exceeds the safe size limit.No
blueprint_remote_tool_unverifiedA remote tool could not be verified against an MCP connection.No
blueprint_mcp_inventory_unavailableThe MCP tool inventory is unavailable.Yes
blueprint_model_scan_pendingCode model analysis is still running.Yes
blueprint_model_scan_failedCode model analysis failed safely.Yes
blueprint_model_unavailableThe configured code-analysis model is unavailable.Yes
invalid_blueprint_manifestThe code blueprint evidence is invalid.No
credential_configuration_errorThe workload identity is not fully configured.No
credential_provider_unsupportedThe workload identity provider is unsupported.No
credential_dependency_missingA workload identity dependency is missing.No
credential_exchange_failedThe workload identity exchange failed.Yes
agent_decision_context_missingThe Agentic decision context is incomplete.No
principal_identifier_missingA stable principal identity is required.No
registry_discovery_emptyNo discoverable agent topology was provided.No
registry_discovery_invalidThe agent discovery payload is invalid.No
registry_discovery_pendingAgent discovery is already in progress.Yes
registry_discovery_rejectedThe agent registry rejected the discovery report.No
registry_discovery_unavailableThe agent discovery service is unavailable.Yes
registry_unavailableThe agent registry is unavailable.Yes
workload_proof_requiredVerified workload identity proof is required.No
agent_access_deniedAgentic authorization denied this operation.No
authorization_deniedAgentic authorization denied this operation.No
authz_engine_errorAgentic authorization denied this operation.No
context_denyAgentic authorization denied this operation.No
no_storeAgentic authorization denied this operation.No
obo_action_not_allowedAgentic authorization denied this operation.No
obo_delegation_requiredAgentic authorization denied this operation.No
obo_no_acts_forAgentic authorization denied this operation.No
obo_scope_mismatchAgentic authorization denied this operation.No
obo_tool_not_allowedAgentic authorization denied this operation.No
obo_user_lacks_permAgentic authorization denied this operation.No
obo_user_mismatchAgentic authorization denied this operation.No

The action and dashboard_path fields in each live ErrorDefinition provide the exact operator guidance and console destination for errors that require a workflow. Prefer those fields over maintaining a second action map in your application.