{"record":{"id":"023c5ba819725c63","repo":"MemPalace/mempalace","slug":"remote-artifact-artifact-id-r-failed-hash-ver","errorCode":null,"errorMessage":"remote artifact {artifact['id']!r} failed hash verification (claimed {artifact['sha256'][:16]}..., computed {digest[:16]}...)","messagePattern":"remote artifact (.+?) failed hash verification \\(claimed (.+?)\\.\\.\\., computed (.+?)\\.\\.\\.\\)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"mempalace/logstream.py","lineNumber":939,"sourceCode":"        artifact_id = _sanitize_routing(artifact_id, \"artifact_id\")\n        with self._lock:\n            conn = self._conn()\n            row = conn.execute(\"SELECT 1 FROM artifacts WHERE id = ?\", (artifact_id,)).fetchone()\n        return row is not None\n\n    def apply_remote_artifact(self, artifact: dict) -> bool:\n        \"\"\"Fold one remote artifact in, idempotently, verifying its hash.\n\n        Content is verbatim; the sha256 must match or the artifact is\n        rejected — a corrupt transfer must never enter the store.\n        \"\"\"\n        for key in (\"id\", \"kind\", \"sha256\", \"content\", \"created_by\", \"created_at\"):\n            if not artifact.get(key):\n                raise ValueError(f\"remote artifact is missing required field {key!r}\")\n        content = artifact[\"content\"]\n        digest = sha256(content.encode(\"utf-8\")).hexdigest()\n        if digest != artifact[\"sha256\"]:\n            raise ValueError(\n                f\"remote artifact {artifact['id']!r} failed hash verification \"\n                f\"(claimed {artifact['sha256'][:16]}..., computed {digest[:16]}...)\"\n            )\n        metadata_json = _sanitize_metadata(artifact.get(\"metadata\"))\n        with self._lock:\n            conn = self._conn()\n            with conn:\n                dup = conn.execute(\n                    \"SELECT 1 FROM artifacts WHERE id = ?\", (artifact[\"id\"],)\n                ).fetchone()\n                if dup:\n                    return False\n                conn.execute(\n                    \"INSERT INTO artifacts (id, kind, sha256, size_bytes, content,\"\n                    \" created_by, created_at, metadata_json, origin_replica)\"\n                    \" VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)\",\n                    (\n                        artifact[\"id\"],","sourceCodeStart":921,"sourceCodeEnd":957,"githubUrl":"https://github.com/MemPalace/mempalace/blob/06cb6987f02610784fefbad4b2bd5d026d164ba6/mempalace/logstream.py#L921-L957","documentation":"Error \"remote artifact {artifact['id']!r} failed hash verification (claimed {artifact['sha256'][:16]}..., computed {digest[:16]}...)\" thrown in MemPalace/mempalace.","triggerScenarios":"Thrown at mempalace/logstream.py:939 when the library encounters an invalid state.","commonSituations":"Artifact bytes were corrupted in transit or the peer served tampered content.","solutions":["Re-fetch the artifact; if the hash still mismatches, treat the peer as untrusted and investigate corruption or tampering"],"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"}