Labour’s Jon Ashworth has pulled out of the final pre-election episode of BBC Question Time, after the programme was criticised for featuring an all-male panel.

The shadow health secretary said he had “no idea” it was an all-male line-up when he agreed take part in the programme, so has agreed to step aside in favour of the Oxford East Labour candidate Anneliese Dodds.

The BBC made clear it never intends to have an all-male line-ups on its five-person panels but instead relies on political parties to put forward female politicians. Ashworth was a last-minute replacement for the shadow cabinet member Laura Pidcock, who had pulled out for personal reasons.

BBC Question Time (@bbcquestiontime) Here is a look at tomorrow’s panel for our show in Hull. Joining Fiona we have @JamesCleverly, @JonAshworth, @IBlackfordSNP, @EdwardJDavey and @TiceRichard #bbcqt pic.twitter.com/m2XGbRvMsp

Harriet Harman, the longest continuously serving female MP, complained: “Oh for goodness sake! Why does BBC think men have all the answers!!! I thought we sorted this in the last century!”

The BBC said it was unhappy with the situation: “You’re right – all-male panels are not the ideal in 2019. The (female) Labour politician we announced yesterday had to pull out for personal reasons. We’re pleased to say Anneliese Dodds has now agreed to appear, and we’re grateful to her for stepping in at short notice.”

Question Time panels usually have at least one political pundit or public figure appearing alongside four politicians, making it easier to ensure at the very least a bare minimum of female representation on the panel. But with just days until the general election, the BBC had decided to offer slots to five major political parties and – after Pidcock withdrew – all the parties had nominated a male politician to take part in the programme.

Instead, Dodds will be joined by the Conservatives’ James Cleverly, the Liberal Democrats’ Ed Davey, the SNP’s Ian Blackford, and Brexit party candidate Richard Tice.

Men-only Question Time panels are very rare and the BBC has made a concerted drive in recent years to increase the number of women appearing on its news and current affairs programme, with many programmes hitting the target of 50:50 representation following a staff-led effort to convince producers to push for equal on-air gender representation.

It is the latest example of the BBC’s editorial decisions coming under substantial scrutiny during this general election, prompting the director of news, Fran Unsworth, to write a defence of the corporation’s impartiality for the Guardian.

She said that given the scale of the BBC’s output, some human mistakes are inevitable, adding: “Conspiracy theories are much in vogue these days. But we are a large organisation that employs thousands of independently minded journalists. Our editors employ their judgments on their own programmes for their own audiences. These aren’t the ideal conditions for a conspiracy.”