Skip to main content

Errors

All Memproof exceptions inherit from MemproofError. Every exception carries three attributes:
  • code — a machine-readable error code string (e.g., "POLICY_DENIED").
  • message — a human-readable description of the error.
  • details — an optional dictionary with additional context.

Base Exception

MemproofError

The base class for all Memproof errors. You can catch this to handle any Memproof-specific exception.
str
Machine-readable error code. Each subclass sets a fixed code value.
str
Human-readable error message.
dict | None
Optional dictionary with structured error details (e.g., validation field errors, matched rule IDs).

Example


Error Subclasses

ValidationError

Code: VALIDATION_ERROR Raised when input data fails validation — for example, when a required field is missing, a field value is out of range, or the content string is empty.
str
required
Description of the validation failure.
dict | None
default:"None"
Optional dictionary with field-level error information. For example: {"field": "content", "error": "must be non-empty"}.
When raised:
  • Content is empty or missing.
  • Scope is missing required fields (tenant_id, project_id, agent_id).
  • ttl_seconds is not a positive integer.
  • limit is outside the 1—100 range.

Example


NotFoundError

Code: NOT_FOUND Raised when a requested resource does not exist.
str
default:"\"Not found\""
Description of what was not found.
When raised:
  • get() is called with a memory_id that does not exist.
  • update() or forget() targets a non-existent memory.
  • get_operation_status() is called with an unknown operation_id.

Example


ConflictError

Code: CONFLICT Raised when an operation conflicts with the current state — typically an idempotency conflict or a concurrent modification.
str
default:"\"Conflict\""
Description of the conflict.
dict | None
default:"None"
Optional details about the conflict (e.g., {"idempotency_key": "mp-abc", "existing_operation_id": "op-xyz"}).
When raised:
  • An idempotency_key is reused with different parameters than the original request.
  • A concurrent modification is detected by the adapter.

Example


PolicyDeniedError

Code: POLICY_DENIED Raised when the policy engine denies an operation based on the configured rules and risk assessment.
str
default:"\"Operation denied by policy rule.\""
Explanation of the denial.
dict | None
default:"None"
May contain reason_codes, matched_rule_ids, and risk_assessment for debugging.
When raised:
  • The policy engine evaluates the operation and returns a deny action.
  • A rule explicitly blocks the operation based on content, scope, risk level, or other criteria.

Example


QuarantinedError

Code: QUARANTINED Raised when the policy engine quarantines an operation for offline review. The memory is not persisted until the quarantine is resolved.
str
default:"\"Operation quarantined.\""
Explanation of the quarantine.
dict | None
default:"None"
May contain the operation_id and reason_codes.
When raised:
  • The policy engine returns a quarantine action.
  • The risk score or content triggers a quarantine rule in the policy configuration.

Example


ApprovalDeniedError

Code: APPROVAL_DENIED Raised when a pending operation is explicitly denied by a human reviewer via the deny() method.
str
default:"\"Approval denied.\""
Explanation of the denial.
dict | None
default:"None"
May contain the reviewer’s actor_id and notes.
When raised:
  • A human reviewer calls deny() on an operation that had a require_approval decision.

ProviderUnavailableError

Code: PROVIDER_UNAVAILABLE Raised when the configured memory adapter backend is unreachable or returns an error.
str
default:"\"Provider unavailable\""
Description of the provider failure.
When raised:
  • The LangGraph checkpoint API is unreachable.
  • The OpenAI Sessions API returns a server error.
  • The MCP memory server connection times out.
  • Any adapter backend fails to respond.

Example


InternalError

Code: INTERNAL_ERROR Raised when an unexpected internal error occurs within the Memproof pipeline.
str
default:"\"Internal error\""
Description of the internal error.
When raised:
  • An unexpected exception occurs during orchestration that does not map to a more specific error type.

Error Handling Patterns

Catch-All

Catch MemproofError to handle any Memproof exception in a single block:

Granular Handling

Handle specific error types differently:

Error Code Reference