This is because the graph associated to f3 as you stated outputs a constant. This means that it is independent of the input x.
The call to grad with f3 thus fails to find x in the graph of f3.
When you call grad, the second argument (here x) is the input for which you want to gradient for. In your case, this input is not in the graph, so you cannot get the gradients wrt to it.