Repository navigation
Description
What happens
POST /businesses without draft=true creates the temporary business (T number) and links it to the account in auth (create_bootstrap + register_bootstrap). Then it calls saving_filings and doesn't check the result. If the request stops before the filing is saved, the T number and the account link stay but no filing exists. That happens when:
only_validate=truewas sent (returns 200 before the save)- validation fails (400)
- the basic checks or authorization checks reject it
save_filingraises (the exception is only logged, so the request probably ends in a 500)
Out of scope: payment failures. The filing is saved before the invoice is created, so a refused payment leaves a normal draft that can be opened and deleted.
What the customer sees
A T number draft in My Business Registry for a business that was never created. It can't be opened because there's no filing behind it. It can't be removed either: for temporary types, the dashboard's removeBusiness calls GET /businesses/{T}/filings first, gets a 404, and stops before the removeAffiliation fallback. Staff have to clean these up by hand.
How to reproduce
On dev with an API account, send POST /businesses?only_validate=true with a valid incorporation body. You get a 200 and nothing is saved, but the account now shows a new T number draft that can't be opened or removed. An invalid one-call body (400) does the same.
Scope / history
From late July until the #35543 fix (lear fae6e2964, 7047af223), every one-call request was rejected by the identifier check after the T number had been created, so every attempt left one of these behind. That includes the 16 sandbox requests run on dev on 2026-11-06. With #35543 fixed, new ones still come from every only_validate=true call and every rejected one-call request.
Ask
- A rejected or validation-only one-call creation should leave nothing behind.
- The leftovers created since July should be cleaned up.
Plan:
- Code fix so new ones can't happen (35637 Legal API - rejected or validate-only business creation leaves a temporary business behind lear#4999):
post_businessesremoves the T number and its account affiliation (deregister_bootstrap+delete_bootstrap) when the request ends without a filing saved against it. A filing saved before a later failure (eg: payment) keeps its T number.
Technical notes
legal-api/src/legal_api/resources/v2/business/business.py,post_businesses:create_bootstrap, thenregister_bootstrap, thenreturn saving_filings(...)with no status check. The@TODO rollback bootstrapcomment is already there.business_filings.py,saving_filings: theonly_validateand validation-error returns happen beforesave_filing. Payment (complete_filing→create_invoice) runs after the save.business_filings.py,delete_filings: this is the only placederegister_bootstrap+delete_bootstrapare called, and it needs a filing id.business-ui/web/business-registry-dashboard/app/stores/affiliations.ts,removeBusiness: for TMP/ATMP/RTMP/CTMP types it requires a filing response before it does anything.- Nothing in gcp-jobs currently cleans up
registration_bootstraps.
Activity
mruff-aeq commentedon Nov 26, 2026
Reproduced on dev. Both of these calls left a T number linked to the account with no filing behind it, so it can't be opened or removed from the dashboard:
Schema errors come back as 422 btw, not 400. Those 2 T numbers can be used to test the cleanup once it's in.