I want to use the inline variable in Iterate Layers to give the output layer of a clip the same name as the input layer. I created a model for this. In the output layer, I use %Name%. I connected the Name from Iterate Layers to the clip as a precondition. However, the %Name% in the clip output keeps causing errors. Any ideas?
Is it writing to the same location as the source feature classes? It may be trying to overwrite... maybe use %Name%_clip or something like that for the output.
It looks as though the problem is that the feature class name you're producing contains spaces.
Try sanitizing them with ValidateTableName.
https://pro.arcgis.com/en/pro-app/latest/arcpy/get-started/working-with-geodatabases.htm
This post shows how you can use Calculate Value to do that: