Get it in writing before you act
First, do not assume you must move out immediately just because the landlord says so. Even when a city flags an unpermitted unit, you generally keep the right to proper notice and process, and you may have additional protections.
Ask for anything in writing from the city — such as a notice or order — so you can see what was actually required and the timeline. Sometimes landlords overstate or rush the situation. The city's order is usually directed at the landlord to fix or stop using the unit, and how it affects your tenancy depends on the details.
In some California cities, when tenants are displaced from an illegal unit through no fault of their own, the landlord may owe relocation assistance. These rules are local and vary, so it is worth checking what applies where you live.
Because your rights and any relocation help depend on the specifics and your location, this is a good moment to get informed before acting. A free, confidential review can look at your notice and situation and explain your options.
This is general information about California tenant rights, not legal advice. Every situation is different.