Sounds like a bad micro switch in the roof assembly. Have you got access to a code scanner?
When I have gotten this it was because I didn't hold the button long enough. I cycled the top up or down making sure to get to final position and the error went away. If this doesn't work then a bad microswitch, loose wire is the probable problem.
Top problems can also be caused by low hydraulic fluid in the system. A 2004 could need fluid without showing any leaks . To check your fluid in the reservoir for the top hydrolic sysyem: It is visible once the rear carpet which is under the rear clam shell and wear the top rests in the opened position. To access this area you will need to open the top to the service position, this is where the top is up in the air and the second section is just about 90 deg. Straight up. You will know you are there if the top does not drift closed. Release the two tension cables connected with ball joints by pushing the connectors off the mounts, this may take some pressure but they just pop off if pushing towards the inside of the car. They are located on either side of the rear section of the top and prevent you from folding the window section forward. Fold the window section forward ( if you have a glass window you may need a strap of bungy to keep the window up) . now the rear compartment carpet should be exposed, it is fastened with four plastic push washers under the roll over system. Carefully unstuck and remove the carpet. Be very careful not to disturbe and wiring or clips once you access the area below the top. In the center of the area you will see what looks like a pump with a bowl made of white plastic below it. It may be difficult to read the marks on the bowl but you should see a fluid line at approximately 1" from the bottom if you don't you need fluid. I would not recommend as a diy unless you have good skills as this is a simple top up in a very sensitive area of your car. Renn tech has great forums on this .
Looking for a Used 911 in your area?
CarGurus has 5,409 nationwide 911 listings starting at $12,984.
Search Porsche 911 Questions
Porsche 911 Experts
Related Models For Sale
Used Cars For Sale