<!--
{
  "availability" : [
    "iOS: 27.0.0 -",
    "iPadOS: 27.0.0 -",
    "tvOS: 27.0.0 -",
    "visionOS: 27.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "RealityKit",
  "identifier" : "/documentation/RealityKit/ShaderGraph/validateAddingEdge(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "RealityKit"
    ],
    "preciseIdentifier" : "s:11ShaderGraphAAC18validateAddingEdgeyyAB0E0VKF"
  },
  "title" : "validateAddingEdge(_:)"
}
-->

# validateAddingEdge(_:)

Validates that an edge can be added to the graph without adding it, throwing a descriptive error if not.

```
final func validateAddingEdge(_ edge: ShaderGraph.Edge) throws
```

## Discussion

Use [`canAddEdge(_:)`](/documentation/RealityKit/ShaderGraph/canAddEdge(_:)) instead when only a yes/no answer is needed.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)