{"record":{"id":"d97411ebd344908f","repo":"mermaid-js/mermaid","slug":"the-right-hand-id-rhsid-is-modified-to-traver","errorCode":null,"errorMessage":"The right-hand id [${rhsId}] is modified to traverse the group boundary, but the edge does not pass through two groups.","messagePattern":"The right-hand id \\[(.+?)\\] is modified to traverse the group boundary, but the edge does not pass through two groups\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/mermaid/src/diagrams/architecture/architectureDb.ts","lineNumber":233,"sourceCode":"      throw new Error(\n        `The left-hand id [${lhsId}] does not yet exist. Please create the service/group before declaring an edge to it.`\n      );\n    }\n    if (!this.nodes.has(rhsId) && !this.groups.has(rhsId)) {\n      throw new Error(\n        `The right-hand id [${rhsId}] does not yet exist. Please create the service/group before declaring an edge to it.`\n      );\n    }\n\n    const lhsGroupId = this.nodes.get(lhsId)!.in;\n    const rhsGroupId = this.nodes.get(rhsId)!.in;\n    if (lhsGroup && lhsGroupId && rhsGroupId && lhsGroupId == rhsGroupId) {\n      throw new Error(\n        `The left-hand id [${lhsId}] is modified to traverse the group boundary, but the edge does not pass through two groups.`\n      );\n    }\n    if (rhsGroup && lhsGroupId && rhsGroupId && lhsGroupId == rhsGroupId) {\n      throw new Error(\n        `The right-hand id [${rhsId}] is modified to traverse the group boundary, but the edge does not pass through two groups.`\n      );\n    }\n\n    const edge = {\n      lhsId,\n      lhsDir,\n      lhsInto,\n      lhsGroup,\n      rhsId,\n      rhsDir,\n      rhsInto,\n      rhsGroup,\n      title,\n    };\n\n    this.edges.push(edge);\n    const lhsNode = this.nodes.get(lhsId);","sourceCodeStart":215,"sourceCodeEnd":251,"githubUrl":"https://github.com/mermaid-js/mermaid/blob/d93e9c88c01a599c062ee6a3f1462e3558ac6b90/packages/mermaid/src/diagrams/architecture/architectureDb.ts#L215-L251","documentation":"Thrown by ArchitectureDB.addEdge when rhsGroup is truthy but both endpoints share the same group (lhsGroupId === rhsGroupId). Mirror of the lhsGroup check: the rhsGroup flag means the edge crosses a group boundary on the RHS, which is impossible inside a single group. Fires only when both endpoints are nodes (services/junctions).","triggerScenarios":"Two services in the same group connected by an edge with rhsGroup: true. e.g. addEdge({lhsId:'a', rhsId:'b', ..., rhsGroup:true}) with both 'a' and 'b' having the same `in` group.","commonSituations":"Copy-paste of edge flags; treating rhsGroup as a styling hint; edge originally between groups later refactored to be intra-group without dropping the flag.","solutions":["Remove rhsGroup when both endpoints are in the same group.","If the edge should cross a boundary, ensure the two endpoints are in different groups."],"exampleFix":"// before\ndb.addEdge({ lhsId: 'a', rhsId: 'b', lhsDir: 'L', rhsDir: 'R', rhsGroup: true }); // same group\n// after\ndb.addEdge({ lhsId: 'a', rhsId: 'b', lhsDir: 'L', rhsDir: 'R' });","handlingStrategy":"validation","validationCode":"function addEdgeSafe(db, e) {\n  const lhsNode = db.getNode(e.lhsId);\n  const rhsNode = db.getNode(e.rhsId);\n  if (e.rhsGroup && lhsNode && rhsNode && lhsNode.in && lhsNode.in === rhsNode.in) {\n    throw new Error('rhsGroup set but both endpoints share a group');\n  }\n  db.addEdge(e);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Only set rhsGroup for genuine boundary-crossing edges.","Re-validate group flags after any structural refactor of groups."],"tags":["architecture","edge","group-boundary","validation"],"backgroundTag":null,"analyzedSha":"d93e9c88c01a599c062ee6a3f1462e3558ac6b90","analyzedAt":"2026-08-12T06:23:11.304Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}