Skip to content

Latest commit

 

History

History
124 lines (97 loc) · 3.59 KB

errors.mdx

File metadata and controls

124 lines (97 loc) · 3.59 KB
title Errors
description Handle stable error codes, machine-readable reasons, request paths, and provider failures.
icon triangle-exclamation

Transformation and restoration failures are atomic: datafog core returns no partially transformed result.

Error fields

Field Meaning
code Stable top-level error category
reason Optional machine-readable detail
message Sanitized human-readable explanation
path Optional RFC 6901 request path
finding_index / findingIndex Optional index of an invalid or conflicting supplied finding
input_index / inputIndex Optional batch member index; finding indexes are local to that member
markerIssues Browser workspace preflight issues with kind and byte/codepoint/UTF-16 ranges

Error messages and metadata do not include matched PII, key material, credentials, token payloads, or restored plaintext.

Error codes

Request validation

  • invalid_configuration
  • invalid_finding
  • review_conflict

review_conflict means overlap selection would leave part of another eligible finding untransformed. Resolve/correct the claims and obtain fresh review before retrying. No partial result or provider call occurs. Exact duplicates, complete containing coverage and explicit entity selection/allowlists retain their documented behavior; all supplied findings validate before filtering.

Key providers

  • key_provider_required
  • key_not_found
  • key_access_denied
  • key_provider_unavailable
  • invalid_key_material
  • key_provider_error

Token providers and envelopes

  • token_provider_required
  • invalid_token
  • unsupported_token_version
  • token_not_found
  • token_expired
  • token_access_denied
  • invalid_token_material
  • token_provider_unavailable
  • token_provider_error

Capability and engine failures

  • unsupported_strategy
  • internal_error

Workspace operations

  • invalid_batch
  • closed_workspace
  • inactive_plan
  • workspace_conflict
  • invalid_marker
  • invalid_snapshot
  • invalid_operation_id, invalid_operation, operation_reused
  • invalid_policy
  • invalid_conversation, conversation_unknown, conversation_pending, invalid_send_intent
  • inactive_stream, invalid_encoding
  • resource_limit

Workspace.restoreReport returns marker issues with text: null; the strict Workspace.restore wrapper throws invalid_marker for those issues. Validation and resource errors can still throw from either call. Source preparation rejects invalid markers before approval and may carry markerIssues on the error.

Optional browser model operations

  • model_load_failed
  • model_inference_failed
  • model_resource_exhausted
  • model_session_busy
  • model_session_closed
  • model_cleanup_failed

Some model pre-validation and initialization failures are native JavaScript exceptions. Catch those at the host boundary too; do not treat failures as an empty successful scan or an implicit rule-only fallback.

See the browser SDK declarations for the complete DataFogErrorCode union.

JavaScript example

try {
  scanAndTransform(text, config);
} catch (error) {
  if (error instanceof DataFogError) {
    console.error(error.code, error.path);
  }
}

Python example

from datafog_core import DataFogConfigurationError

try:
    scan_and_transform(text, config)
except DataFogConfigurationError as error:
    print(error.code, error.reason, error.path)
Branch on `code` and `reason`, not on the human-readable message.