{"record":{"id":"7e338f1814b2953d","repo":"bytedance/deer-flow","slug":"failed-to-parse-canonical-fact-path-exc","errorCode":null,"errorMessage":"Failed to parse canonical fact {path}: {exc}","messagePattern":"Failed to parse canonical fact (.+?): (.+?)","errorType":"exception","errorClass":"MemoryStorageCorruption","httpStatus":null,"severity":"error","filePath":"backend/packages/harness/deerflow/agents/memory/backends/deermem/deermem/core/storage.py","lineNumber":313,"sourceCode":"        metadata = yaml.safe_load(front) or {}\n        if not isinstance(metadata, dict):\n            raise ValueError(\"front matter is not a mapping\")\n        body = body.lstrip(\"\\n\")\n        lines = body.splitlines()\n        title = \"\"\n        if lines and lines[0].startswith(\"# \"):\n            title = lines.pop(0)[2:].strip()\n            if lines and not lines[0].strip():\n                lines.pop(0)\n        metadata[\"title\"] = title\n        metadata[\"content\"] = \"\\n\".join(lines).rstrip(\"\\n\")\n        metadata[\"scope\"] = {\n            \"userId\": metadata.pop(\"user_id\", None),\n            \"agentName\": metadata.pop(\"agent_name\", None),\n        }\n        return metadata\n    except (OSError, UnicodeError, ValueError, yaml.YAMLError) as exc:\n        raise MemoryStorageCorruption(f\"Failed to parse canonical fact {path}: {exc}\") from exc\n\n\ndef _fsync_parent_directory(directory: Path) -> None:\n    \"\"\"Make a completed rename durable on POSIX filesystems.\"\"\"\n    if os.name == \"nt\":\n        return\n    descriptor = os.open(directory, os.O_RDONLY)\n    try:\n        os.fsync(descriptor)\n    finally:\n        os.close(descriptor)\n\n\ndef _atomic_write(path: Path, raw: bytes) -> None:\n    path.parent.mkdir(parents=True, exist_ok=True)\n    temp = path.with_name(f\".{path.name}.{uuid.uuid4().hex}.tmp\")\n    try:\n        with open(temp, \"wb\") as handle:","sourceCodeStart":295,"sourceCodeEnd":331,"githubUrl":"https://github.com/bytedance/deer-flow/blob/1dd6ba1acb03700589994b0366c5d1c7d05e2eff/backend/packages/harness/deerflow/agents/memory/backends/deermem/deermem/core/storage.py#L295-L331","documentation":"Error \"Failed to parse canonical fact {path}: {exc}\" thrown in bytedance/deer-flow.","triggerScenarios":"Thrown at backend/packages/harness/deerflow/agents/memory/backends/deermem/deermem/core/storage.py:313 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Fix the YAML/schema error named in the exception inside the fact file.","Delete or quarantine the corrupted fact file and let the system rebuild it."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"1dd6ba1acb03700589994b0366c5d1c7d05e2eff","analyzedAt":"2026-08-14T21:20:34.804Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}