A passport that has not expired can still be refused. Many destinations require validity well beyond the intended departure date, and the check happens at the airline desk rather than at the border.
The requirement is measured from departure, not arrival
A common rule requires a passport to remain valid for a set period beyond the date the traveller intends to leave the country.
That means the calculation depends on the return date, so extending a trip can push a passport out of compliance without anything else changing.
Some countries measure from arrival instead, and others require only validity for the duration of stay, so the rule cannot be generalised.
Airlines enforce it before governments do
Carriers are penalised for bringing a passenger who is refused entry and must return them at their own cost, which makes the check commercially unavoidable.
Ground staff apply the rule mechanically against a database of entry requirements, and they have no discretion to accept a marginal case.
This is why refusal usually happens at check-in, hours before any border official would have seen the document.
Blank pages are a separate requirement
Several countries require a minimum number of entirely blank pages, and endorsement pages at the back often do not count toward it.
Visas that occupy a full page consume the allowance quickly for frequent travellers, and pages cannot generally be added to modern passports.
Damage is judged separately again: a passport with water damage, a loose page or a compromised photo can be refused despite being in date.
Transit and connections have their own rules
A country passed through may impose its own document requirements even where the traveller never leaves the terminal.
Where a connection requires immigration clearance, the transit country's entry rules apply in full, including any visa requirement.
Name matching matters here as well, since the booking must match the passport closely enough for automated checks to pass.
Building in time to renew
Processing times for renewals vary considerably and lengthen seasonally, so renewing well before the deadline is the only reliable approach.
Some countries add remaining validity from an old passport to a new one, and others do not, which changes when renewal is worthwhile.
Entry requirements change and are set by each destination, so the authoritative source is the destination's own consular information for the specific nationality travelling.