Have you ever been struck by a sudden excruciating pain, concluded you need to get to the hospital, only to be totally fine and pain-free two seconds later?  What causes these pains to appear in the absence of other symptoms or obvious ailments?

The sensation of pain has all to do with our sensory nerves. When you burn your finger or cut yourself, tiny pain receptors (nociceptors) in the skin detect that damage has been caused. These little receptors are attached to nerve cells, so their stimulation leads to a signal being sent up the nerve fiber. Many of these nerve fibers together form a peripheral nerve, which transmits the message to the spinal cord as an electrical impulse. Then, by traveling along nerve cells, the signal reaches the brain and makes its way to the thalamus, a region that plays an important role in pain perception.

Next, pain signals get relayed to the somatosensory cortex, the frontal cortex, and the limbic system. These are responsible for physical sensations, thinking, and emotions, respectively. This all happens at lightning speed so that when you hurt yourself, you feel physical pain, think “ouch!”, and feel upset or angry that you got hurt. Meanwhile, your body will activate a reflex response to minimize harm – if you’ve touched something hot, you will find your hand jerking away from the burning object. While we have nociceptors in our skin to detect external sources of pain, we also have internal ones situated in our muscles, joints, digestive system, and internal organs that warn us of harmful stimuli within our bodies, like tumors or infections.

So, what triggers random pains that seem to have no obvious cause?

“If you have the experience of a sharp stabbing pain that doesn’t appear to have any cause, it might just be a compression injury, the nerve may get some kind of stimulus where it’s compressed, or you may have a trapped nerve in the spine, something you’d have with backache,” explained Francis McGlone, professor of Neuroscience at Liverpool John Moores University, to IFLScience, noting that sudden, random pains are unlikely to be caused by pain nerves firing by mistake and tend to signal a problem.

Nerves can become compressed when surrounding tissues exert pressure on them. This is commonly known as a pinched nerve and can be mild to severe. The pressure can simply be caused by repetitive motions or keeping your body in the same position for a long period of time (for example, if you fall asleep with a bent limb). It can also be caused by inflammation due to injury or infection, as swollen tissue can put additional pressure on nearby nerves. Playing sports and exercising are common ways to get a trapped nerve, sometimes as a result of repetitive motions or forcing the body into unnatural positions. And the pain doesn’t necessarily stay in one place – a compressed nerve in the neck might cause arm pain, for example.

If you want to reduce your risk of suffering a pinched nerve, it’s a good idea to avoid staying in the same position for a long time, the Mayo Clinic notes. You can also work out to improve your strength and flexibility, avoid doing repetitive activities for prolonged amounts of time, and try to maintain a healthy weight. Obesity can increase your risk of compression pain as extra weight places more pressure on the nerves.

The pain of a compressed nerve can be short-lived, getting better with rest, while for some people, surgery is required to treat it. More severe cases include nerve compression from a herniated disk or carpal tunnel syndrome in the wrist.

“The pain system is normally quite good at doing its job, which is basically to alert your head that there’s something going wrong somewhere in your body and normally you would then take care of wherever that signal’s coming from,” said Professor McGlone.

While pains generally signal injuries or infections, it is possible to experience pain in response to something that shouldn’t cause it. One such condition is known as allodynia and is rare. It involves the feeling of pain in response to things like a gentle touch, something moving across your skin (like a towel), or temperature changes that aren’t great enough to harm the body. Essentially, sufferers feel nasty pains when they shouldn’t. But this isn’t psychological, the pain they feel is real.

Allodynia is believed to be caused by a hypersensitive central nervous system, something also thought to play a role in chronic fatigue syndrome and fibromyalgia – a long-term condition that causes widespread pain. The pain signals come from overly sensitized nociceptors; they start interpreting all sorts of harmless stimuli, from hairbrushes to hugs, as painful encounters.

Unfortunately, there is currently no cure for allodynia, it is merely treated with painkillers and lifestyle changes such as avoiding wearing certain fabrics that trigger pain. Certain conditions can increase your risk of experiencing allodynia, including migraines, diabetes, and fibromyalgia, but the phenomenon is still rare.

“Another example is phantom limb pain, where patients get an excruciating experience of pain coming from a foot that’s no longer there,” noted Professor McGlone. “You get that a lot with painful diabetic neuropathy where patients get searing, terrifying pain generally in a lower limb but all the pain nerves are basically gone.”

Neuropathic pain results from damage or disease that interrupts the functioning of the sensory nervous system and involves the body relaying pain signals to the brain unprompted by a stimulus. The pain is usually chronic and linked to conditions such as diabetes, where high blood sugar levels damage peripheral nerves, sometimes leading to amputation, and injuries to the spinal cord. Neuropathic pain contrasts with nociceptive pain, the kind of pain we normally get following an injury.

Generally, if you experience pain, it’s a sign that something’s wrong. However, if the pain is fleeting and doesn’t return, the pain’s cause has likely dissipated on its own and is probably nothing to worry about. Trapped wind can cause sharp stomach pains, while limb pain might simply be the result of a pulled muscle and even chest pains can be caused by a harmless condition called primordial catch syndrome. However, if you are worried about pains you are experiencing or feel severe or long-lasting pains, it’s important to visit your doctor so that any potential conditions can be diagnosed and treated as quickly and effectively as possible.