An image forming apparatus including: a transport path in which an recording medium passes; a transport member disposed in the transport path so as to transport the recording medium; a transport guide member constituting the transport path so as to guide the recording medium; and a detection mechanism disposed in the transport path so as to detect presence or absence of the recording medium, the detection mechanism including an actuator portion configured to swing when abutting the recording medium, and a sensor portion configured to detect swinging of the actuator portion, the actuator portion includinga shaft portion extending in a width direction of the recording medium, which is orthogonal to a transport direction of the recording medium, and a detection portion disposed to protrude outward in the radial direction from the shaft portion so as to swing about the shaft portion in a transport direction when abutting the recording medium, the transport guide member includes a base portion, and a plurality of first guide ribs standing on the base portion at a predetermined interval in the width direction of the recording medium so as to guide the recording medium, the first guide ribs are provided with a notch portion through which the shaft portion of the actuator portion penetrates, characterized in that the shaft portion is provided with a second guide rib disposed at a position corresponding to at least one of the first guide ribs in which the notch portion is formed, so as to protrude outward in the radial direction from the shaft portion, and before the recording medium abuts the detection portion, the second guide rib is disposed so as to close an opening (33b, 33c) of the corresponding notch portion viewed from an axis direction of the shaft portion, thereby to prevent the recording medium from entering the notch portion. a transport path in which an recording medium passes; a transport member disposed in the transport path so as to transport the recording medium; a transport guide member constituting the transport path so as to guide the recording medium; and a detection mechanism disposed in the transport path so as to detect presence or absence of the recording medium, the detection mechanism including an actuator portion configured to swing when abutting the recording medium, and a sensor portion configured to detect swinging of the actuator portion, the actuator portion includinga shaft portion extending in a width direction of the recording medium, which is orthogonal to a transport direction of the recording medium, and a detection portion disposed to protrude outward in the radial direction from the shaft portion so as to swing about the shaft portion in a transport direction when abutting the recording medium, the transport guide member includes a base portion, and a plurality of first guide ribs standing on the base portion at a predetermined interval in the width direction of the recording medium so as to guide the recording medium, the first guide ribs are provided with a notch portion through which the shaft portion of the actuator portion penetrates, characterized in that the shaft portion is provided with a second guide rib disposed at a position corresponding to at least one of the first guide ribs in which the notch portion is formed, so as to protrude outward in the radial direction from the shaft portion, and before the recording medium abuts the detection portion, the second guide rib is disposed so as to close an opening (33b, 33c) of the corresponding notch portion viewed from an axis direction of the shaft portion, thereby to prevent the recording medium from entering the notch portion.