One can also use Bessel's method, moving the lens between the two positions where there is a focused image (enlarged or smaller):
$$f = \frac{D^2 -d^2}{4D},$$
where $D$ is the distance between object and image and $d$ the distance between the two ens positions.
This also works for thick lenses.
For all of these specific, weird cases, I usually start by getting a general solution. I make the solution as direct as possible: derive the expressions that spit out the required outputs straight from the given inputs. Then I plug in the numbers for the weird case and see what happens.
For the first lens, image position and image size are given by:
$$
s_1' = - \frac{f_1 s_1}{f_1-s_1}
$$
$$
h_1' = - \frac{h_1 s_1'}{s_1}
$$
For the second lens at distance $d$, object position and size are:
$$s_2 = d - s_1' = d + \frac{f_1 s_1}{f_1-s_1}$$
$$h_2 = h_1' = - \frac{h_1 s_1'}{s_1}$$
So image position and size are:
$$
s_2' = - \frac{f_2 s_2}{f_2-s_2} = \frac{d f_{1} f_{2} - {\left(d - f_{1}\right)} f_{2} s_{1}}{d f_{1} - f_{1} f_{2} - {\left(d - f_{1} - f_{2}\right)} s_{1}}
$$
$$
h_2' = - \frac{h_2 s_2'}{s_2} = -\frac{f_{1} f_{2} h_{1}}{d f_{1} - f_{1} f_{2} - {\left(d - f_{1} - f_{2}\right)} s_{1}}
$$
Finally, total magnification is:
$$
m = \frac{h_2'}{h_1} = -\frac{f_{1} f_{2}}{d f_{1} - f_{1} f_{2} - {\left(d - f_{1} - f_{2}\right)} s_{1}}
$$
The weird case you're interested in is when $s_1 = f_1$. Let's plug it into the equations:
$$ s_2' = f_2 $$
$$ h_2' = - \frac{f_2 h_1}{f_1} $$
$$ m = - \frac{f_2}{f_1} $$
So it would seem that the system should work without any weird infinities after all. Interesting.
Some notes
Technically, I used simplifications that can hide a division by zero. A more proper way of doing all this would be to keep the ugly expressions as they are, without canceling out potential zeros:
$$ s_2' = \frac{{\left(d + \frac{f_{1} s_{1}}{f_{1} - s_{1}}\right)} f_{2}}{d - f_{2} + \frac{f_{1} s_{1}}{f_{1} - s_{1}}}$$
$$ h_2' = -\frac{f_{1} f_{2} h_{1}}{{\left(d - f_{2} + \frac{f_{1} s_{1}}{f_{1} - s_{1}}\right)} {\left(f_{1} - s_{1}\right)}}$$
$$ m = -\frac{f_{1} f_{2}}{{\left(d - f_{2} + \frac{f_{1} s_{1}}{f_{1} - s_{1}}\right)} {\left(f_{1} - s_{1}\right)}}$$
Plugging in $s_1 = f_1$ directly will now properly lead to divisions by zero so we can't do it. What we can do, however, is calculate the limit of these expressions as $s_1$ approaches $f_1$, which leads to the exact same solution as before.
BTW, I used SageMath for all of this. I'd rather not do it by hand.
Best Answer
The image could be real or virtual. We'll start with a real image. Also, we'll consider a point object and an ideal lens.
For a real image of a point to be formed, the rays emitted by or reflected from that point have to converge at some other point in space.
If a point (blue dot on the diagrams below) is placed in a focal plane of a convex lens and its rays, collected by the lens, are coming out parallel to each other, they, obviously, are not going to to converge and, therefore, are not going to form an image.
If a point is placed in front of the focal plane, the rays are going to converge and form a real image.
If a point is placed behind the focal plane (i.e. between the focal plane and the lens), the rays are going to diverge and, therefore are not going to form a real image. If the diverging rays are extended backwards, they will meet at some point (of the apparent divergence) behind the lens, forming a virtual image.
Hopefully, this clarifies the picture.