{"record":{"id":"261362dd1e88118c","repo":"MemPalace/mempalace","slug":"source-room-source-room-does-not-exist-in-wing","errorCode":null,"errorMessage":"Source room '{source_room}' does not exist in wing '{source_wing}'","messagePattern":"Source room '(.+?)' does not exist in wing '(.+?)'","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"mempalace/palace_graph.py","lineNumber":559,"sourceCode":"    \"\"\"\n    source_wing = _require_name(source_wing, \"source_wing\")\n    source_room = _require_name(source_room, \"source_room\")\n    target_wing = _require_name(target_wing, \"target_wing\")\n    target_room = _require_name(target_room, \"target_room\")\n\n    # Single MempalaceConfig() per call — reused by _get_tunnel_file /\n    # _load_tunnels / _save_tunnels below. Each MempalaceConfig() re-reads\n    # mempalace.yaml from disk; before this change the helpers each\n    # instantiated their own, triggering several redundant disk reads per\n    # create_tunnel call (flagged by gemini-code-assist on #1469).\n    config = config or MempalaceConfig()\n\n    # Validate room existence for explicit tunnels only. Use the verbatim wing\n    # slugs here so #1504's hyphen-preserving write path remains intact.\n    if kind == \"explicit\":\n        col = _get_collection(config)\n        if not _check_room_exists(source_wing, source_room, col):\n            raise ValueError(f\"Source room '{source_room}' does not exist in wing '{source_wing}'\")\n        if not _check_room_exists(target_wing, target_room, col):\n            raise ValueError(f\"Target room '{target_room}' does not exist in wing '{target_wing}'\")\n\n    tunnel_id = _canonical_tunnel_id(source_wing, source_room, target_wing, target_room)\n\n    tunnel = {\n        \"id\": tunnel_id,\n        \"source\": {\"wing\": source_wing, \"room\": source_room},\n        \"target\": {\"wing\": target_wing, \"room\": target_room},\n        \"label\": label,\n        \"kind\": kind,\n        \"created_at\": datetime.now(timezone.utc).isoformat(),\n    }\n    if source_drawer_id:\n        tunnel[\"source\"][\"drawer_id\"] = source_drawer_id\n    if target_drawer_id:\n        tunnel[\"target\"][\"drawer_id\"] = target_drawer_id\n","sourceCodeStart":541,"sourceCodeEnd":577,"githubUrl":"https://github.com/MemPalace/mempalace/blob/06cb6987f02610784fefbad4b2bd5d026d164ba6/mempalace/palace_graph.py#L541-L577","documentation":"Error \"Source room '{source_room}' does not exist in wing '{source_wing}'\" thrown in MemPalace/mempalace.","triggerScenarios":"Thrown at mempalace/palace_graph.py:559 when the library encounters an invalid state.","commonSituations":"Tunnel creation referenced a source room that does not exist.","solutions":["Create the source room first, or check the wing/room names for typos"],"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"}