{"record":{"id":"a8ee20db4d828d11","repo":"mermaid-js/mermaid","slug":"the-left-hand-id-lhsid-is-modified-to-travers","errorCode":null,"errorMessage":"The left-hand id [${lhsId}] is modified to traverse the group boundary, but the edge does not pass through two groups.","messagePattern":"The left-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":228,"sourceCode":"        `Invalid direction given for right hand side of edge ${lhsId}--${rhsId}. Expected (L,R,T,B) got ${String(rhsDir)}`\n      );\n    }\n\n    if (!this.nodes.has(lhsId) && !this.groups.has(lhsId)) {\n      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,","sourceCodeStart":210,"sourceCodeEnd":246,"githubUrl":"https://github.com/mermaid-js/mermaid/blob/d93e9c88c01a599c062ee6a3f1462e3558ac6b90/packages/mermaid/src/diagrams/architecture/architectureDb.ts#L210-L246","documentation":"Thrown by ArchitectureDB.addEdge when lhsGroup is truthy but both endpoints resolve to the same group (lhsGroupId === rhsGroupId). The lhsGroup flag declares that the edge crosses a group boundary on the LHS; if both endpoints are inside the same group there is no boundary to traverse, so the flag is contradictory. Note the lookup uses nodes.get(...).in, so this check only fires when both endpoints are nodes (services/junctions), not groups.","triggerScenarios":"Two services declared in the same group, with an edge between them that carries lhsGroup: true. e.g. addService({id:'a', in:'g'}), addService({id:'b', in:'g'}), addEdge({lhsId:'a', rhsId:'b', lhsDir:'L', rhsDir:'R', lhsGroup:true}).","commonSituations":"Copy-pasting edge flags from a cross-group edge to an intra-group edge; misunderstanding the lhsGroup flag as a styling toggle rather than a boundary-traversal marker.","solutions":["Remove lhsGroup (set it false/undefined) when both endpoints are in the same group.","If boundary traversal is genuinely intended, move one endpoint into a different group."],"exampleFix":"// before\ndb.addGroup({ id: 'g' });\ndb.addService({ id: 'a', in: 'g' });\ndb.addService({ id: 'b', in: 'g' });\ndb.addEdge({ lhsId: 'a', rhsId: 'b', lhsDir: 'L', rhsDir: 'R', lhsGroup: true });\n// after — drop the boundary flag for an intra-group edge\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.lhsGroup && lhsNode && rhsNode && lhsNode.in && lhsNode.in === rhsNode.in) {\n    throw new Error('lhsGroup set but both endpoints share a group');\n  }\n  db.addEdge(e);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Only set lhsGroup when the edge genuinely crosses a group boundary.","When moving an endpoint between groups, clear lhsGroup/rhsGroup if it becomes intra-group."],"tags":["architecture","edge","group-boundary","validation"],"backgroundTag":null,"analyzedSha":"d93e9c88c01a599c062ee6a3f1462e3558ac6b90","analyzedAt":"2026-08-12T06:23:11.304Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}