{"record":{"id":"4c67c72e37c06974","repo":"bytedance/deer-flow","slug":"mem0-startup-policy-must-be-one-of-sorted-startu","errorCode":null,"errorMessage":"mem0 startup_policy must be one of {sorted(_STARTUP_POLICIES)}","messagePattern":"mem0 startup_policy must be one of (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"backend/packages/harness/deerflow/agents/memory/backends/mem0/config.py","lineNumber":97,"sourceCode":"            raise ValueError(f\"mem0 failure_policy has unknown keys: {sorted(unknown_fp)}\")\n        allow_insecure_http = cfg.get(\"allow_insecure_http\", False)\n        if not isinstance(allow_insecure_http, bool):\n            raise ValueError(\"mem0 allow_insecure_http must be a boolean\")\n\n        config = cls(\n            api_key_env=str(cfg.get(\"api_key_env\", \"MEM0_API_KEY\")),\n            base_url=str(cfg.get(\"base_url\", \"https://api.mem0.ai\")).rstrip(\"/\"),\n            allow_insecure_http=allow_insecure_http,\n            top_k=int(cfg.get(\"top_k\", 8)),\n            score_threshold=float(cfg.get(\"score_threshold\", 0.1)),\n            max_injection_chars=int(cfg.get(\"max_injection_chars\", 12000)),\n            timeout_seconds=float(cfg.get(\"timeout_seconds\", 10.0)),\n            startup_policy=str(cfg.get(\"startup_policy\", \"fail_fast\")),\n            read_policy=str(failure_policy.get(\"read\", \"fail_open\")),\n            write_policy=str(failure_policy.get(\"write\", \"log_and_drop\")),\n        )\n        if config.startup_policy not in _STARTUP_POLICIES:\n            raise ValueError(f\"mem0 startup_policy must be one of {sorted(_STARTUP_POLICIES)}\")\n        if config.read_policy not in _READ_POLICIES:\n            raise ValueError(f\"mem0 failure_policy.read must be one of {sorted(_READ_POLICIES)}\")\n        if config.write_policy not in _WRITE_POLICIES:\n            raise ValueError(f\"mem0 failure_policy.write must be one of {sorted(_WRITE_POLICIES)}\")\n        if not 1 <= config.top_k <= 1000:\n            raise ValueError(\"mem0 top_k must be in [1, 1000]\")\n        if not 0.0 <= config.score_threshold <= 1.0:\n            raise ValueError(\"mem0 score_threshold must be in [0, 1]\")\n        if config.max_injection_chars <= 0:\n            raise ValueError(\"mem0 max_injection_chars must be positive\")\n        if config.timeout_seconds <= 0:\n            raise ValueError(\"mem0 timeout_seconds must be positive\")\n        if not config.api_key_env.strip():\n            raise ValueError(\"mem0 api_key_env must be a non-empty env var name\")\n        parsed_base_url = urlsplit(config.base_url)\n        if parsed_base_url.scheme not in {\"http\", \"https\"} or not parsed_base_url.netloc:\n            raise ValueError(\"mem0 base_url must be an absolute http:// or https:// URL\")\n        if parsed_base_url.scheme == \"http\" and not config.allow_insecure_http:","sourceCodeStart":79,"sourceCodeEnd":115,"githubUrl":"https://github.com/bytedance/deer-flow/blob/1dd6ba1acb03700589994b0366c5d1c7d05e2eff/backend/packages/harness/deerflow/agents/memory/backends/mem0/config.py#L79-L115","documentation":"Raised by Mem0Config.from_backend_config when memory.backend_config.startup_policy is not one of the two supported values: fail_fast (default; performs an auth check in from_config so a bad key/URL fails at boot) and tolerate (defer checks to first use). The values are checked after str() coercion, so any other string (including typos and case variants) is rejected.","triggerScenarios":"startup_policy: fast_fail, fail-fast, Fail_Fast, lazy, or startup_policy: \"\" in backend_config.","commonSituations":"Typos and case mismatches; using vocabulary from other systems (lazy/deferred/eager); copy-pasting from outdated docs.","solutions":["Use exactly fail_fast or tolerate (lowercase, underscore)","For production, keep the default fail_fast so auth problems surface at startup","Remove the key entirely if the default (fail_fast) is what you want"],"exampleFix":"# before (config.yaml)\nmemory:\n  backend_config:\n    startup_policy: fast-fail   # not recognized\n\n# after\nmemory:\n  backend_config:\n    startup_policy: fail_fast","handlingStrategy":"validation","validationCode":"STARTUP_POLICIES = {\"fail_fast\", \"tolerate\"}\n\ndef startup_policy_ok(backend_config: dict) -> bool:\n    return str((backend_config or {}).get(\"startup_policy\", \"fail_fast\")) in STARTUP_POLICIES","typeGuard":"def is_startup_policy(v: object) -> bool:\n    return v in (\"fail_fast\", \"tolerate\")","tryCatchPattern":null,"preventionTips":["Use the exact lowercase tokens fail_fast / tolerate","Omit the key when the default (fail_fast) is desired — fewer tokens, fewer typo surfaces"],"tags":["config","mem0","memory","validation"],"backgroundTag":null,"analyzedSha":"1dd6ba1acb03700589994b0366c5d1c7d05e2eff","analyzedAt":"2026-08-14T21:20:34.804Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}