I got An error with "hugo server" locally

env:

Blockquote
hugo v0.147.8-10da2bd765d227761641f94d713d094e88b920ae+extended+withdeploy windows/amd64 BuildDate=2025-06-07T12:59:52Z VendorInfo=gohugoio
GOOS=“windows”
GOARCH=“amd64”
GOVERSION=“go1.24.0”

command:hugo server

ERROR template: _shortcodes/twitter.html:21:25: executing “render-tweet” at <resources.GetRemote>: error calling GetRemote: Get “https://publish.twitter.com/oembed?dnt=false&url=https%3A%2F%2Ftwitter.com%2FSanDiegoZoo%2Fstatus%2F1453110110599868418”: dial tcp 108.160.170.52:443: connectex: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
Built in 21628 ms

i just clicked on the link in the error message and it I get a json back.

seems to be a local networking problem or a temporary issue

you might try to manually download that with ur browser or wget, curl or powershell.

the deafult hugo timeout is 60s. maye play with that.

But I can also get the json by clicking.

Maybe the network is not the reason.

the timeout is for the whole page… - but then I would have expected a different error message

Unable to check that without access to your repo.

that code works fine:

{{ $url := "https://publish.twitter.com/oembed?dnt=false&url=https%3A%2F%2Ftwitter.com%2FSanDiegoZoo%2Fstatus%2F1453110110599868418" }}
{{ with try (resources.GetRemote $url) }}
   {{ with .Err }}
      {{ errorf "%s" . }}
   {{ else with .Value }}
      {{ highlight (.Content | transform.Remarshal "json" | transform.Unmarshal| jsonify (dict "indent" "  ")) "JSON" }}
   {{ else }}
      {{ errorf "Unable to get remote resource %q" $url }}
   {{ end }}
{{ end }}
{
  "author_name": "San Diego Zoo Wildlife Alliance",
  "author_url": "https://twitter.com/sandiegozoo",
  "cache_age": "3153600000",
  "height": null,
  "html": "\u003cblockquote class=\"twitter-tweet\"\u003e\u003cp lang=\"en\" dir=\"ltr\"\u003eOwl bet you\u0026#39;ll lose this staring contest 🦉 \u003ca href=\"https://t.co/eJh4f2zncC\"\u003epic.twitter.com/eJh4f2zncC\u003c/a\u003e\u003c/p\u003e\u0026mdash; San Diego Zoo Wildlife Alliance (@sandiegozoo) \u003ca href=\"https://twitter.com/sandiegozoo/status/1453110110599868418?ref_src=twsrc%5Etfw\"\u003eOctober 26, 2021\u003c/a\u003e\u003c/blockquote\u003e\n\u003cscript async src=\"https://platform.twitter.com/widgets.js\" charset=\"utf-8\"\u003e\u003c/script\u003e\n\n",
  "provider_name": "Twitter",
  "provider_url": "https://twitter.com",
  "type": "rich",
  "url": "https://twitter.com/sandiegozoo/status/1453110110599868418",
  "version": "1.0",
  "width": 550
}

Is there any way to avoid this error? I can manually download the json,but where should I put it?

OH,my repo is GitHub - Ceritor-Hanio/hanio.github.io: An example hugo static site with Toha theme.

This is the all reply form Hugo. But I still don’t understand how to solve it.

WARN “D:\Internet-blog\hanio.github.io\content\notes\bash_index.bn.md:1:1”: duplicate menu entry with identifier “notes-bash” in menu “notes”
WARN “D:\Internet-blog\hanio.github.io\content\notes\go_index.bn.md:1:1”: duplicate menu entry with identifier “notes-go” in menu “notes”
WARN “D:\Internet-blog\hanio.github.io\content\notes\go\advanced_index.bn.md:1:1”: duplicate menu entry with identifier “notes-go-advanced” in menu “notes”
WARN The “twitter”, “tweet”, and “twitter_simple” shortcodes were deprecated in v0.142.0 and will be removed in a future release. Please use the “x” shortcode instead.
WARN “D:\Internet-blog\hanio.github.io\content\notes\go\basic_index.bn.md:1:1”: duplicate menu entry with identifier “notes-go-basics” in menu “notes”
WARN “D:\Internet-blog\hanio.github.io\content\posts\category_index.bn.md:1:1”: duplicate menu entry with identifier “category” in menu “sidebar”
WARN “D:\Internet-blog\hanio.github.io\content\posts\category\sub-category_index.bn.md:1:1”: duplicate menu entry with identifier “sub-category” in menu “sidebar”
ERROR template: _shortcodes/tweet.html:21:25: executing “render-tweet” at <resources.GetRemote>: error calling GetRemote: Get “https://publish.twitter.com/oembed?dnt=false&url=https%3A%2F%2Ftwitter.com%2FSanDiegoZoo%2Fstatus%2F1453110110599868418”: dial tcp 208.77.47.172:443: connectex: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
Built in 21565 ms
Error: error building site: logged 1 error(s)

I guess you have to switch to the X shortcode, as the tweed, twitter… havae been deprecated in hugo 141.0

maybe iupdate the theme, overwrite the shortcode… hard to tell without your sources

What you said makes sense!Maybe the theme(hugo-toha) still use the out shortcode.But that is funny,because it just updates at Apr 26.

This works great for me:

git clone --recurse-submodules https://github.com/Ceritor-Hanio/hanio.github.io
cd hanio.github.io/
npm i
hugo server

You have a local problem.

I guess that I have some networking problems when hugo try to get the json. Maybe I need a method to bypass error.

Remove the two shortcode calls from your content. They’re just examples.

These network errors are reported as suppressible warnings in v0.147.9 and later.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.