The 24 character error code is a failure of the short Disk Self Test and would indicate that the Hard Drive is failing and needs to be replaced. This is also consistent with the boot issue you describe.
If your notebook is still under warranty, contact HP and arrange to have the drive replaced - If needed, you can check your warranty status Here.
If you are in another part of the world, start Here.
If you are out of warranty and would like a guide on replacing the Hard Drive yourself, please let me know - include the full Model No. and Product No. of your Envy 6 series notebook - see Here for a further explanation.