During Japan's Sakoku (closed country) period (from the 1630s to the 1850s) foreigners were barred from entering Japan. According to this Wikipedia entry, foreigners illegally entering would face the death penalty:
https://en.wikipedia.org/wiki/Sakoku_Edict_of_1635#Decrees_of_the_Edict
However, this list shows numerous attempts to enter Japan over the years:
https://en.wikipedia.org/wiki/Sakoku#Challenges_to_seclusion
And none seem to end with execution.
Was this more or less any empty bluff, or is there any documented case of foreign visitors being executed?
A couple of poorly-tolerated intrusions in the very early sakoku period (in the 1630s and 1640s) were made by Catholic priests, largely Jesuits and Franciscans. These were all largely solitary arrivals with no military backing or trade interests, but as religious transgressions they met with a pretty stiff response. Many were Europeans, like Guillaume Courtet and Antonio Gonzalez (both killed in 1637); the overwhelming majority of these European priests were executed, but there were rare exceptions like Giuseppe Chiara, who was apprehended after entering Japan in 1633 and lived to be a ripe old age there after formally renouncing Christianity after torture. A number of Japanese Jesuits who returned to Japan after the various edicts were also subsequently executed despite being born and raised in Japan -- Petro Kibe was executed in 1639, Diego Ryosetsu in 1635, and former boy-ambassador Julian Nakaura in 1632. These aren't representative of the kinds of foreign visitors at your link, which seem to be mainly trade/military-oriented, but these executions and their reputation as incidents of gory martyrdom may have fed into the reputation of encounters post-1633 as generally fatal to any outsiders caught trying to sneak in.
That Wikipedia list is incomplete, missing some important incidents that built up the fearsome foreign reputation of the Sakoku decrees.
The first was in 1639. The Portuguese in Macao sent an embassy to Japan to try to re-establish a relationship. For defying the decree, the shogunate executed most of the crew (around sixty people, including all the Portuguese members), and sent back about eleven Macao-native sailors with a warning. This was the only time, as far as I am aware, that Japan actually executed foreign sailors, but the story in all its gory details became well known abroad from Engelbert Kaempfer's History of Japan, first published in 1727.
Kaempfer served as physician at the Dutch trading post of Dejima in Nagasaki, and was one of the few Westerners to have travelled to the capital Edo. His history of Japan was the primary source on Japanese history and culture for more than a century. Alongside 1639 executions, Kaempfer relates a story of a Spanish ship whose crew were also killed in Nagasaki, but as there are no Western records, it seems the Japanese account he relied on may actually be an exaggerated version of the Portuguese incident. (The Japanese certainly did conflate Spain and Portugal.)
/u/cdesmoulins covers some of the early Jesuit fates, but there's also a fascinating later Jesuit intrusion into Japan. Giovanni Battista Sidotti arrived in Japan in 1707, was immediately arrested, and set the shogunate into confusion over what to do with him. The high-ranking shogunate official Arai Hakuseki had extensive face-to-face discussions (via a translator) with Sidotti, and recommended that Sidotti be deported rather than executed or (as in the case of the early Jesuits) tortured to try to force him to recant. From his memoirs, Hakuseki seems to have respected and even liked Sidotti as a fellow educated scholar, but been dismayed at how ridiculous Sidotti's religion seemed.
Other officials rejected Hakuseki's recommendation of deportation. There was no precedent for that in the decrees. Instead, Sidotti was imprisoned for life. Hakuseki requested that he be treated more like a guest than a prisoner. However, when Sidotti went on to convert the Japanese couple looking after him, they were executed, and Sidotti's treatment went downhill. He was either purposely starved or died as a side effect of ill treatment in 1714.
The shogunate's long reluctance to torture or execute Sidotti was reflected in their treatment of other foreigners who ended up in Japan. As the Wikipedia list does show, a number of merchants, whalers, diplomatic missions, and (on one occasion) a boatload of Australia-bound convict mutineers landed in Japan during the Edo Period, and the usual response was to send them on their way with water and supplies as quickly as possible. Shipwrecked sailors would be held in Nagasaki until they could be shipped out via the East India Company's vessels. However, these encounters did not all go so smoothly. In the late 1840s, two separate incidents whipped up American public fury against Japan, laying a foundation for Commodore Perry’s expedition.
In 1846, seven shipwrecked sailors from the American whaler Lawrence landed their launch on Kuril Islands. Local Ainu people conveyed them to Japanese authorities, and the seven were transported to Nagasaki. In their accounts of the experience, the Americans emphasized the harsh treatment and threats of their captors. While in Nagasaki, one of the sailors attempted to escape, and was killed by the Japanese guards. “Inhumanely murdered” according to the second mate, Howe, although the carpenter Wells’ story is a bit more nuanced: the man died of a head wound incurred while trying to escape. After seventeen months captivity, during which officials in Edo took a very long time to reply to Nagasaki’s requests for orders, the surviving Americans were shipped out on East India Company ship. The American whalers arrived home in the United States with a story to tell the newspapers which provoked outrage against Japan.
In 1848, seven sailors deserted the whaler Lagoda, on account of cruel treatment from its captain. They landed in Hokkaido, where they were imprisoned while officials waited for a ship to remove them. Some of the sailors twice attempted to escape from prison, and were subsequently beaten and held in cages. After being transported to Nagasaki, the Americans were placed in a less confined prison, and informed they would be transported out by Dutch ship, but the official permission for their release was somehow delayed. Despairing for their release, the Americans began another series of escapes, one even getting out of the city and roaming around the surrounding hills. To the Nagasaki magistrate this looked like attempted espionage. The magistrate finally confined the men to cages in the ordinary Nagasaki prison. One of the men hung himself, another died from exposure. The Americans became convinced the Japanese doctor was trying to poison them. At last, five months after they’d first came to Nagasaki, they were released to an American naval vessel which had come to demand their release.
Other foreign castaways in Japan had a much better time of it. At the exact same time as the Lagoda prisoners suffered in their endless cycle of escape and retribution, a Canadian named Ranald Macdonald was in Nagasaki, also waiting for deportation, and having the time of his life. Macdonald had purposely "shipwrecked" himself in Hokkaido to see Japan, enjoyed everything about the culture and language, and became the first English teacher in Japan to eager Nagasaki students of Dutch. (The Japanese considered Macdonald an American. Speaking as a Canadian tourist, some things never change . . . ) The Japanese treatment of prisoners could be harsh under any circumstances, but there were definitely some huge cultural/language misunderstandings in the Lawrence and Lagoda cases, which led to the deaths of three Americans.
If you’re interested, you can read a full detailed account of the American incidents in this B.A. thesis: Diplomacy Far Removed: A Reinterpretation of the U.S. Decision to Open Diplomatic Relations with Japan by Bruce Makoto Arnold.