{"record":{"id":"856cd2be07127146","repo":"mermaid-js/mermaid","slug":"the-index-pos-for-linkstyle-is-out-of-bounds-v","errorCode":null,"errorMessage":"The index ${pos} for linkStyle is out of bounds. Valid indices for linkStyle are between 0 and ${this.edges.length - 1}. (Help: Ensure that the index is within the range of existing edges.)","messagePattern":"The index (.+?) for linkStyle is out of bounds\\. Valid indices for linkStyle are between 0 and (.+?)\\. \\(Help: Ensure that the index is within the range of existing edges\\.\\)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/mermaid/src/diagrams/flowchart/flowDb.ts","lineNumber":394,"sourceCode":"   */\n  public updateLinkInterpolate(positions: ('default' | number)[], interpolate: string) {\n    positions.forEach((pos) => {\n      if (pos === 'default') {\n        this.edges.defaultInterpolate = interpolate;\n      } else {\n        this.edges[pos].interpolate = interpolate;\n      }\n    });\n  }\n\n  /**\n   * Updates a link with a style\n   *\n   */\n  public updateLink(positions: ('default' | number)[], style: string[]) {\n    positions.forEach((pos) => {\n      if (typeof pos === 'number' && pos >= this.edges.length) {\n        throw new Error(\n          `The index ${pos} for linkStyle is out of bounds. Valid indices for linkStyle are between 0 and ${\n            this.edges.length - 1\n          }. (Help: Ensure that the index is within the range of existing edges.)`\n        );\n      }\n      if (pos === 'default') {\n        this.edges.defaultStyle = style;\n      } else {\n        this.edges[pos].style = style;\n        // if edges[pos].style does have fill not set, set it to none\n        if (\n          (this.edges[pos]?.style?.length ?? 0) > 0 &&\n          !this.edges[pos]?.style?.some((s) => s?.startsWith('fill'))\n        ) {\n          this.edges[pos]?.style?.push('fill:none');\n        }\n      }\n    });","sourceCodeStart":376,"sourceCodeEnd":412,"githubUrl":"https://github.com/mermaid-js/mermaid/blob/d93e9c88c01a599c062ee6a3f1462e3558ac6b90/packages/mermaid/src/diagrams/flowchart/flowDb.ts#L376-L412","documentation":"Error \"The index ${pos} for linkStyle is out of bounds. Valid indices for linkStyle are between 0 and ${this.edges.length - 1}. (Help: Ensure that the index is within the range of existing edges.)\" thrown in mermaid-js/mermaid.","triggerScenarios":"Thrown at packages/mermaid/src/diagrams/flowchart/flowDb.ts:394 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"d93e9c88c01a599c062ee6a3f1462e3558ac6b90","analyzedAt":"2026-08-12T06:23:11.304Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}