bytedance/deer-flow · error · ValueError

OpenViking failure_policy.write must be 'log_and_drop' or 'r

Error message

OpenViking failure_policy.write must be 'log_and_drop' or 'raise'

What it means

OpenVikingConfig._validate() rejects memory.backend_config.failure_policy.write values outside {'log_and_drop','raise'}. write_failure_policy controls whether a failed memory capture is logged and the conversation turn continues (log_and_drop, the default) or raises MemoryManagerError (raise). The value is lowercased before validation.

Source

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

            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.write: log_and_drop (default; write failures are logged and skipped) or raise (write failures raise MemoryManagerError)
  2. Remove the failure_policy.write key to accept the log_and_drop default
  3. Restart the Gateway after the config edit

Example fix

# before (config.yaml)
memory:
  backend_config:
    failure_policy:
      write: warn   # invalid

# after
memory:
  backend_config:
    failure_policy:
      write: log_and_drop
Defensive patterns

Strategy: validation

Validate before calling

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

Type guard

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

Try / catch

try:
    OpenVikingMemoryManager.from_config(backend_config)
except ValueError as exc:
    raise SystemExit(f"Invalid OpenViking memory config: {exc}") from exc

Prevention

When it happens

Trigger: Setting memory.backend_config.failure_policy.write to anything other than 'log_and_drop' or 'raise' — e.g. 'drop', 'warn', 'fail_open'. Raised during OpenVikingConfig.from_backend_config -> _validate() at manager construction.

Common situations: Assuming the read-side value 'fail_open' also works for writes; abbreviating 'log_and_drop' to 'drop' or 'log'; using 'warn' because startup_policy accepts it.

Related errors


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