Check $error - you may find a hint as to what went wrong. You can also call prompt interactively, errors should be displayed to the screen when you do that.
You can debug your prompt by setting a breakpoint:
Set-BreakPoint -Command Prompt
Then you can step through and see what's going wrong.