Since you specifically said that you are killed before becoming permanent, it depends on whether you are using the original Rules as intended or if you go with the optional rule of the Xanathar All Guide.
According to this quality control, if you cast a spell without a valid target (which would be the True Polymorphed object in this case), the spell space is not consumed and nothing happens. To summarize Jeremy Crawford's statements in the Sage Advice segment, one of the Dragon Talk podcasts here (specifically at 1:12 pm for ~ 7.5 minutes), "illegal targeting" is a void in the written rules (from the date of the podcast) and is open mainly to DM to choose how to handle it. That said, there is an intention of how it should be handled, which is that the cast must still take the cast time, but the spell will not occur and will not consume a spell space. The reason for the taste of this is that he sees the spells as essentially trying to make a magical connection between the caster and the target. When that connection is established, the energy of the spell is consumed by producing the effect of the spell, but if the target is not one, the spell may make a connection, nothing happens and that energy is not spent.
While Xanathar says that YOU actually use the spell space.
Invalid spell targets
A spell specifies what a caster can aim with him: any type of creature, a creature of a certain type (humanoid or beast, for example), an object, an area, the caster or something else. But what happens if a spell points to something that is not a valid target? For example, someone could throw a lovely person over a creature that is believed to be a humanoid, without knowing that the target is a vampire. If this problem arises, treat it with the following rule.
If you cast a spell on someone or something that cannot be affected by the spell, nothing happens to that target, but if you used a spell space to cast the spell, the space is still spent. If the spell normally has no effect on a target that succeeds in a save shot, the invalid target seems to have succeeded in its save shot, even though it did not attempt one (without giving indications that the creature is in fact an invalid target) Otherwise, you perceive that the spell did nothing to the target.
We know that the creature will once again be an object when it reaches 0 HP, as specifically indicated by True Polymorph
The transformation lasts for the duration, or until the target falls to 0 hit points or dies.
So, to give an order of events of a kind here
- I threw TP on my couch and made it a goblin for simplicity and I call it Greg
- Greg immediately flees
- About 30 minutes later I am still concentrating on the spell because I want to make it permanent.
- Around that time, Greg fights and disintegrates
- My cleric friend comes and sees him disintegrate
- She kills whatever killed him and then, being too optimistic, throws TR and in the absence of a body says his name
This is where it gets difficult. One of two things happens, but more or less they share the same end result that the sofa goblin doesn't resurrect.
Or you go through the original RAI and spend an hour casting the spell and she says Greg and then nothing happens.
Or B, you follow Xanathar's rule, which makes you spend an hour casting the spell, you say Greg at the end and spend the space (and I suppose diamonds and holy water are worth 25,000 in gold).
Whatever happens, Greg died and became an object again when his HP hit 0, which makes him an invalid target.