… at least in my case, it was because of an overlapping rule definition:

```
%make_trees(Roots, Childre, Trees)
make_trees([], [], [tree(nil,[])]).
make_trees([], [tree(Data,Children)], [tree(Data,Children)]).
make_trees([], [H|T], [tree(nil, [H|T])]).
...
```

…needed to be

```
make_trees([], [], [tree(nil,[])]).
make_trees([], [tree(Data,Children)], [tree(Data,Children)]), !. % Add cut
make_trees([], [H|T], [tree(nil, [H|T])]).
...
```

or

```
make_trees([], [], [tree(nil,[])]). % len ==0
make_trees([], [tree(Data,Children)], [tree(Data,Children)]). % len ==1
make_trees([], [H0, H1|T], [tree(nil, [H0, H1|T])]). % len >=2
...
```

Debugging this kind of thing is a PITA.