Integrate on a subdomain error: missing an integration domain

I am integrating on the boundary of a subdomain, which is defined as following

class S0(SubDomain):
\quad def inside(self, x, on_boundary):
\quad\quad return (near_line(0,x) and not(near_line(1,x)))
\quad Wxx, Wxy = find_W(domain_vertices[0], domain_vertices[1])
\quad mx,my = find_m(domain_vertices[0], domain_vertices[1])

s0 = S0()
boundaries = MeshFunction(‘size_t’, mesh, 1, mesh.domains())
boundaries.set_all(1)
s0.mark(boundaries, 0)

and I have no issue performing this integral

fy_elastic = (sxy_elastic * s0.mx - sxx_elastic * s0.my) * ds(0)
+ 2 * Ea * (Qxx * s0.Wxy - Qxy * s0.Wxx) * s0.mx * ds(0)

Fy_elastic = assemble(fy_elastic)

However when I perform a very similar integral

fx_elastic = (sxx_elastic * s0.mx + sxy_elastic * s0.my) * ds(0)
+ 2 * Ea * (Qxx * s0.Wxy - Qxy * s0.Wxx) * s0.my * ds(0)

Fx_elastic = assemble(fx_elastic)

It tells me This integral is missing an integration domain!

I mean how can this happen, these two integrals are essentially the same thing, as physically they are forces in x and y direction, but python can do one but not the other! I am extremely confused and any help would be greatly appreciated.

Please add a minimal working example. As the code above lacks many of the key definitions, there is no way of telling what you are doing wrong. Please follow the guidelines from Read before posting: How do I get my question answered?

Sorry about that.

Anyway I seem to solve this issue by reformatting it into

fx_elastic = (sxx_elastic * s0.mx + sxy_elastic * s0.my + 2 * Ea * (Qxx * s0.Wxy - Qxy * s0.Wxx) * s0.my) * ds(0)