I’m still a beginner with designscript, so excuse me if this is a stupid question…
I’ve been noticing that replication guides often give me inconsistent results. Here is an example of what I mean:

Here I’m trying to change the replication guide from <1> to <0>, then back to <1>. The result after changing the replication guide back was different than it was before changing it. Why is that? I’ve been noticing this happening with several times. What am I doing wrong?
I don’t know if ‘0’ is supported as a replication guide. Can you reproduce with 1 and 2?
Can you provide a SMALL sample dyn which replicates the issue using basic data?
101025.dyn (4.7 KB)
I tried it with the list in this .dyn, and I’m still facing the same issues.
This is strange… how do I fix this? Or is there a way for me to rewrite my code so that I don’t have to face this issue? I know I can use nodes instead, but I’m trying not to use too many nodes because I find that my script ends up looking messy.
Nodes, building it as a custom node (.dyf nodes), imperative design script, definitions, avoiding replication guides, or Python would work.
You could also reconsider how you go go about this - creating a dictionary instead of a list up front, or using List.FilterByBoolMask might work out well.
Ok, we got an answer from Luis Rivera who did a deeper dive into design script’s execution engine. I’m quoting him here:
Issue is that the generated DSASM assembly is not generating proper instructions for the replication guides of default arguments.String.Contains(lst<1>,"Width", true ) executes without issue.
String.Contains(lst<1>,"Width") generates assembly for two replication guides but the executive expects three.What is happening in the videos shown is:
- State 1 (repguides:
[]):
- Replications guides
[1,0] get pushed into the stack. Repguides are now [1,0]
- The executive asks for three replication guides, doesnt get them and doesnt pop them either, and acts as if there’s no replication guides.
- State 2 (repguides:
[1,0]):
- Replications guides
[1,0] get pushed into the stack. Repguides are now [1,0,1,0]
- The executive asks for three replication guides, gets
[0,1,0] from the top of the stack, pops them.
- State 3 (repguides
[1])
- Replications guides
[1,0] get pushed into the stack. Repguides are now [1,1,0]
- The executive asks for three replication guides, gets
[1,1,0] from the top of the stack, pops them.
- We’re back at state 1.
So the part of Dynamo which executes your code has to fill out the replication guides on each run, but as you’re providing only 2/3 inputs you get a hanging list that gets added to the next time you run it. On the good news front there is already work underway to resolve this issue. Unfortunately this will only apply the fix in a future Dynamo release, so you’ll have to use a work-around for now. Fortunately the work-around isn’t too difficult - always apply the 3rd input and utilize the replication guides on each input.
By providing the missing input (true) and the results come consistently. So using String.Contains(lst<1>,"Width", true); should resolve your issue consistently, and if you find out otherwise, please let us know. 
Fix is now available on dynamobuilds.com daily builds, since version 4.0.0.2885 . Thanks for the heads up to track and find this bug! For older versions, the workaround is to just fill all default parameters as Jacob mentioned.