bytedance/deer-flow · error · ValueError

OpenViking failure_policy.read must be 'fail_open' or 'raise

Error message

OpenViking failure_policy.read must be 'fail_open' or 'raise'

What it means

OpenVikingConfig._validate() rejects memory.backend_config.failure_policy.read values outside {'fail_open','raise'}. read_failure_policy decides whether a failed recall (memory injection) returns empty context (fail_open, the default) or propagates the error into the agent run (raise). The value is lowercased before validation.

Source

Thrown at backend/packages/harness/deerflow/agents/memory/backends/openviking/config.py:139

            raise ValueError("OpenViking default_peer_id must start with a lowercase letter or digit and contain at most 64 lowercase letters, digits, '_' or '-'")
        if self.default_peer_id.startswith(GENERATED_PEER_PREFIX):
            raise ValueError(f"OpenViking default_peer_id must not start with the reserved prefix {GENERATED_PEER_PREFIX!r}")
        if not isfinite(self.timeout_seconds) or self.timeout_seconds <= 0:
            raise ValueError("OpenViking timeout_seconds must be a finite value > 0")
        if not 1 <= self.search_top_k <= 100:
            raise ValueError("OpenViking retrieval.top_k must be between 1 and 100")
        if self.score_threshold is not None and (not isfinite(self.score_threshold) or not 0 <= self.score_threshold <= 1):
            raise ValueError("OpenViking retrieval.score_threshold must be a finite value between 0 and 1")
        if not 256 <= self.max_injection_chars <= 100_000:
            raise ValueError("OpenViking retrieval.max_injection_chars must be between 256 and 100000")
        if self.content_mode not in {"auto", "abstract", "overview", "read"}:
            raise ValueError("OpenViking retrieval.content_mode must be auto, abstract, overview, or read")
        if not self.injection_query:
            raise ValueError("OpenViking retrieval.injection_query must not be empty")
        if self.startup_policy not in {"fail_fast", "warn"}:
            raise ValueError("OpenViking startup_policy must be 'fail_fast' or 'warn'")
        if self.read_failure_policy not in {"fail_open", "raise"}:
            raise ValueError("OpenViking failure_policy.read must be 'fail_open' or 'raise'")
        if self.write_failure_policy not in {"log_and_drop", "raise"}:
            raise ValueError("OpenViking failure_policy.write must be 'log_and_drop' or 'raise'")
        if not 16 <= self.max_seen_message_ids <= 10_000:
            raise ValueError("OpenViking max_seen_message_ids must be between 16 and 10000")


def is_safe_peer_id(value: str) -> bool:
    """Return whether *value* is valid for an OpenViking actor peer."""

    return _SAFE_PEER_RE.fullmatch(value) is not None


def _mapping(value: Any, name: str) -> dict[str, Any]:
    if value is None:
        return {}
    if not isinstance(value, dict):
        raise ValueError(f"OpenViking {name} must be a mapping")
    return dict(value)

View on GitHub (pinned to 1dd6ba1acb)

Solutions

  1. Set memory.backend_config.failure_policy.read: fail_open (default; recall failures yield empty memory) or raise (recall failures propagate)
  2. Remove the failure_policy.read key to accept the fail_open default
  3. Restart the Gateway so the corrected config is reloaded

Example fix

# before (config.yaml)
memory:
  backend_config:
    failure_policy:
      read: fail_closed   # honcho term, invalid here

# after
memory:
  backend_config:
    failure_policy:
      read: fail_open
Defensive patterns

Strategy: validation

Validate before calling

allowed = {"fail_open", "raise"}
val = str((raw_backend_config.get("failure_policy") or {}).get("read", "fail_open")).strip().lower()
assert val in allowed, f"failure_policy.read must be one of {sorted(allowed)}, got {val!r}"

Type guard

def is_valid_read_policy(value: object) -> bool:
    return isinstance(value, str) and value.strip().lower() in {"fail_open", "raise"}

Try / catch

try:
    OpenVikingMemoryManager.from_config(backend_config)
except ValueError as exc:
    log_config_error(exc); fix_and_retry()

Prevention

When it happens

Trigger: Setting memory.backend_config.failure_policy.read to anything other than 'fail_open' or 'raise' — e.g. 'fail_closed' (the honcho backend's term), 'log', 'ignore'. Raised during OpenVikingConfig.from_backend_config -> _validate() at manager construction.

Common situations: Porting a honcho backend_config block to OpenViking and keeping 'fail_closed'; typo like 'fail-open' or 'failopen'; believing there is a silent 'log' mode.

Related errors


AI-assisted analysis of bytedance/deer-flow@1dd6ba1acb (2026-08-14). Data as JSON: /api/errors/dab0a3a392d2f1d8. Report an issue: GitHub.