Cannot connect to Moonraker Error

Printer Model: custom build ( like pursa bear )
MCU / Printerboard: btt octapus pro h723
Host / SBC: btt cb1
klippy.zip (1006.4 KB)
moonraker.log (81.3 KB)

Cannot connect to Moonraker Error - Random Disconnects

Hi everyone

I’m experiencing a frustrating issue with my Klipper setup. During prints, I randomly get disconnected from Mainsail with the following error:

Cannot connect to Moonraker

Sometimes it happens after a long print, and sometimes it happens multiple times in a few seconds. It’s completely random and very disruptive.

I have noticed similar behavior on a server PC I have running Mainsail in the background as a sort of dashboard for my printers. After an hour or so Mainsail will randomly switch to the screen shown in the screenshot, then I have to click the “Try Again” button to reconnect. This doesn’t interrupt prints, but it is a bit annoying.

Yes, it doesn’t affect printing, but it’s very annoying

Sometimes it happens multiple times in less than a minute (like 10 times or more)

This sounds more like a topic on the level of the operating system or networking than something directly related to Mainsail or Moonraker.

Honestly

I dont have any idea about it

Do you use WiFi or a wired LAN connection?

I use it with wifi

Do you use automatic IP assignment (DHCP) or dedicated IP addresses?
How many devices are hooked up to your WiFi network?

About the frist two questions
How should i check that

About device’s (usually 2 maximum 4)

Sorry for getting back so late. Well,…time and setting up a PC with Ubuntu to try the command.
I guess right now you have more important things going on. Best wishes, stay safe!

I’m not sure, if we should discuss this here in the Klipper forum. You’ll find better help in the WWW.

If the hunch from Sineos is right and I can imagine he is right.

WiFi is working in the ISM band ISM radio band - Wikipedia. WiFi uses the 2.4 GHz, 5 GHz, or 6 GHz bands Wi-Fi - Wikipedia (usually just 2.4 GHz or 5 GHz band). Check which band you are using. “Tell” your WiFi router to use the other one. Maybe someone is disturbing your used frequency (can be a cheap (or defect) electronic device like a microwave oven). Since you come from Iran (no offense), I could imagine there are no or very little authorities who try to find disturbers.

Try in a terminal:

You see the results with just my WiFi connected and my WiFi plus LAN connected.

There are some scenarios you could try. I’ll start with the easiest one.

  1. Try a wired LAN. The chance of disturbances are much smaller.

  2. Give your LAN members dedicated IP addresses. With dedicated IP addresses, it will make it much easier to investigate problems.

Good luck, hcet14

Hi Hect14,

Thank you for your response, and sorry for the delay in replying.

We’re currently in a war situation, and the government is heavily restricting internet access. This is the first time in four days that I’ve been able to connect.

Our city is also under frequent attacks—almost daily—so it’s been quite difficult to keep up.

I will follow all your instructions and post the results here as soon as possible.

Thanks again for your support.

1 Like

I am back !!

I did find out that Klipper discourse now requires a VPN for me to open it in my country

It’s weird because it’s just a 3d printing website !!! Thank you, my government

any way

My wifi only supports 2.4 GHz

You have some authorities that finds disturbers !! wow

I am a Windows user

I will try this and inform you about results

but 3d printer and wifi and the laptob that controls them are very close
like under 5 meter

Wow, amazing…

Click on your “Windows” symbol, then type “cmd” (just the 3 alphabetic characters). A windows terminal will pop up.
Type “ipconfig” (just the alphabetic characters) in the terminal and press enter.

yes

Also, about VPNs — free VPNs from Google Play or the App Store usually don’t work.

If you want a working VPN, you have to buy it from independent sellers (most of the time V2Ray) and hope you get a stable connection.

You also have to hope the seller doesn’t get caught and arrested by the government. If that happens, you’ll lose your connection, and they’ll end up in jail.

Besides that, these VPNs aren’t always safe. I’ve heard that some sellers get their servers from the government (or something like that — I’m not an expert in network stuff).

It kind of makes sense
Some people only accept crypto payments, but others even give you their bank account number so you can transfer money, and when you do, you can see their real name. Yet they never get arrested.

any way

I did as you asked

Here are the results

Of course. Forget all the internet browsers. Even tor browser doesn’t work with geo blocking anymore with a website for car racing here.
But you might try above in your country, if you want to save money. That may be a way to reach more sites in your WWW. VPN providers want to earn money :wink:, which is absolutely ok.

Ok, can you post a new screenshot?

Power off your 3D printer and use “ipconfig -all”.

hi sorry for replying late i had some VPN problems

The only VPNs that work here are the ones we pay for
They like this (someone buy a VPS or something like that that is out of country and then make a VPN from it )

about the IP config all

I did it twice

One with the printer on and one without it


First one with printer on


printer off

I have to feel sorry for answering so late. Sorry I forgot about this topic.

S*it, I’m glad to live in my country.

Sorry but your answer didn’t help me. Can you provide a rough picture (schematics) of your network. You said there are usually 2, maximum 4 clients connected. Just tell me how each client is connected (wired or wireless).

Sorry that I’m answering late, I was busy changing my internet provider ( previous one was expensive ), and also I was busy taking care of my bird (sadly we lost him)

In the past few days, that I didn’t have internet connection on my wifi, everything was fine
The Klipper Connection Failed screen happened much, much less than the times that I had internet on my router

Now that I have internet in my router, I tried something
I started uploading a file on WhatsApp, and when I was doing that connection appeared as fast as old times

about my connection that you asked me to provide as a picture

Also, I finally found what is happening to our internet ( I asked two network experts about that )
(I don’t understand any of the things that they said, and I translated them using ChatGPT)

first explanation

The state of the Internet in Iran after the recent clashes with Israel has undergone significant changes, especially from a technical perspective and in terms of communication protocols. These changes appear to be part of the government’s security strategies to control and monitor Internet traffic. In the following, we will scientifically analyze these changes, their possible reasons, and their implications for TCP, UDP protocols, and V2Ray configurations, based on available information.

1. Disruption of the TCP protocol for DNS (tcp://8.8.8.8):

The TCP protocol is used for DNS queries that require high reliability, since it relies on mechanisms like handshaking and acknowledgment to ensure data delivery. The malfunction or blocking of TCP indicates the intentional imposition of restrictions at the network infrastructure level.

2. Disruption of the UDP protocol for non-standard ports (udp://9.9.9.9:9953):

Filtering non-standard ports is likely part of a strategy to restrict circumvention tools (such as VPNs and V2Ray) that often use uncommon ports to conceal their traffic. This measure aims to reduce access to foreign servers and increase monitoring of domestic traffic.

3. High latency in DoH servers:

The DoH protocol uses HTTPS (port 443) to send DNS queries in encrypted web traffic, making it harder to detect and filter. However, the high latency may result from bandwidth throttling or targeted monitoring of HTTPS traffic.
Cloudflare Radar data shows that after the recent clashes, Iran’s Internet traffic has drastically decreased (by up to 97% at certain times), and the mix of HTTP protocols has changed, with HTTP/1.x (the older version) now accounting for a larger share compared to HTTP/2 and HTTP/3. This may indicate attempts to restrict newer, more secure protocols like HTTP/3, which operates over QUIC and UDP.

Conclusion:
The state of the Internet in Iran following the recent clashes indicates an intensification of filtering and surveillance policies aimed at controlling cyberspace and limiting access to foreign information. The imposed restrictions on TCP and UDP for DNS and the failure of V2Ray configurations are the result of advanced filtering techniques such as DPI (Deep Packet Inspection) and TLS fingerprinting. These measures not only make Internet access more difficult but also have broad implications for freedom of expression, the digital economy, and user privacy.

secend explanation

Cloudflare Under the Shadow of New Firewall Filtering Changes

According to GFW-Knocker’s analysis, all regular Cloudflare IPs have been whitelisted under the new firewall filtering changes. This means that only the SNI of well-known websites is allowed to pass through, while all other sites and personal domains are blocked—whether fragmented or not. Regardless of whether they are officially filtered or not, they are not permitted to pass.

On port 443, lesser-known websites are completely blocked, and even unfiltered personal domains are inaccessible. Moreover, if you try to access a well-known site using a fragmentation method, the firewall won’t be able to correctly read the domain name and will block it too. In short, until the firewall is certain that the domain is on the allowed list, it will not let the connection proceed, even if it’s a normal browser accessing a normal site.

On port 80, the ws protocol is completely blocked. If the word websocket appears in a packet, it will be filtered. Even if you send the data in fragments, the packets will stop passing after the seventh packet.

So, what can be done? The real answer is clear: freedom for Iran. But until that happens, the only option is to use various stealth techniques—tricks that, if made public, will be blocked by the censors.

For Cloudflare’s port 80, an xhttp packet-up configuration without TLS, using a domain that is not yet filtered and with the fakeHost option enabled in the Mahsa core, still works. Of course, there is always the risk that the domain will be blocked. The good news is that the Mahsa core will soon be updated so that this type of configuration can work with filtered domains on all Cloudflare IPs.

For Cloudflare’s port 443, since Cloudflare’s IP ranges are whitelisted, they are practically useless for bypassing and there’s not much that can be done. There are some options like using scanners, the ECH method, manipulating ClientHello, or asking Cloudflare administrators to enable Domain Fronting, but the chances of success are low.

Hi Farzad,

I have to apologize for getting back so late. I have to admit, I forgot the thread :hushed_face:

Sorry about your bird.

I fear we talk past each other.

I would like to have a simple schematics, how your “Internet” is set up by hardware.

Let me try to explain for what I’m looking for.

From you picture it looks like a TP-Link TL-WA830RE TL-WA830RE | 300Mbps Wi-Fi Range Extender | TP-Link . This is a Wireless Range Extender. I guess you connect it with a LAN cable and than you connect all your devices wireless.

If I guess right, than we have this

My questions are:

  • where comes the “internet signal” from? Out of which device! Please provide all info’s from that device (manufacturer and type)!
  • on which device runs Mainsail, when you prepare and start a print?

Hi, and thanks for your answer.

No problem, it’s my fault, I sent the information that you asked for late

kinda missed him, he was beautiful

ints not a

its TD-W8960N 300Mbps Wireless N ADSL2+ Modem Router

TD-W8960N | 300Mbps Wireless N ADSL2+ Modem Router | TP-Link

This modem is connected to the telephone line ( with gray connector near LANs), and I’m not using its LAN ports — just the Wi-Fi functionality.
Everything is connected via Wi-Fi.

From the back, it looks like this:

also about

mainsoil is running on a btt cb1

The btt cb1 is connected to TD-W8960N via wifi