{"record":{"id":"d518798854a46a89","repo":"MemPalace/mempalace","slug":"write-routing-policy-must-be-one-of-direct-prefe","errorCode":null,"errorMessage":"write routing policy must be one of: direct, prefer, require","messagePattern":"write routing policy must be one of: direct, prefer, require","errorType":"validation","errorClass":"WriteRoutingError","httpStatus":null,"severity":"error","filePath":"mempalace/write_routing.py","lineNumber":106,"sourceCode":"    Legacy boolean settings additionally map truthy values to ``prefer`` and\n    falsy values to ``direct`` so existing ``hooks.daemon`` configurations\n    retain their historical behavior.\n    \"\"\"\n\n    if isinstance(value, WriteRoutingPolicy):\n        return value\n\n    if legacy_boolean and isinstance(value, bool):\n        return WriteRoutingPolicy.PREFER if value else WriteRoutingPolicy.DIRECT\n\n    if legacy_boolean and isinstance(value, int) and not isinstance(value, bool):\n        if value == 1:\n            return WriteRoutingPolicy.PREFER\n        if value == 0:\n            return WriteRoutingPolicy.DIRECT\n\n    if not isinstance(value, str):\n        raise WriteRoutingError(\"write routing policy must be one of: direct, prefer, require\")\n\n    normalized = value.strip().lower()\n\n    try:\n        return WriteRoutingPolicy(normalized)\n    except ValueError:\n        pass\n\n    if legacy_boolean:\n        if normalized in _LEGACY_TRUE:\n            return WriteRoutingPolicy.PREFER\n        if normalized in _LEGACY_FALSE:\n            return WriteRoutingPolicy.DIRECT\n\n    raise WriteRoutingError(\n        f\"invalid write routing policy {value!r}; expected direct, prefer, or require\"\n    )\n","sourceCodeStart":88,"sourceCodeEnd":124,"githubUrl":"https://github.com/MemPalace/mempalace/blob/06cb6987f02610784fefbad4b2bd5d026d164ba6/mempalace/write_routing.py#L88-L124","documentation":"Error \"write routing policy must be one of: direct, prefer, require\" thrown in MemPalace/mempalace.","triggerScenarios":"Thrown at mempalace/write_routing.py:106 when the library encounters an invalid state.","commonSituations":"Write routing policy value was not one of the supported names.","solutions":["Set the policy to one of: direct, prefer, require"],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"06cb6987f02610784fefbad4b2bd5d026d164ba6","analyzedAt":"2026-08-15T03:03:36.213Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}