I don't think the issue here is crossing OPTIONAL boundaries and more a syntax error in the original queries - 400 Error would indicate a malformed query that doesn't parse. Note that in your working query, ?s crosses the boundary, resulting in a join between the mandatory and optional BGPs. Do you get a more detailed message back with your Error 400? Perhaps if you run your query with a curl -v and capture the full output, you might get a hint as to what is actually happening