Unable to establish loopback connection

Running FileBot from the console, Groovy scripting, shell scripts, etc
Post Reply
paulnd
Posts: 10
Joined: 06 Oct 2013, 15:45

Unable to establish loopback connection

Post by paulnd »

Hello,

I'll be grateful for assistance please.

The MS Store Filebot app was updated to v5.0.3 (r9760) today and when using the following from a windows batch file,

Code: Select all

filebot -script fn:amc "D:/Kodi Holding/Incoming/" --output "D:/Kodi Holding/Processed/" --conflict override -non-strict --def  clean=y extras=y  >> "D:\Kodi Holding\filebot.log" 2>&1
the follow error appears in the log

Code: Select all

Error (o_O)
Failed to fetch resource: https://api.filebot.net/9760/script/fn.jar.xz: Unable to establish loopback connection
Unable to establish loopback connection
java.io.UncheckedIOException: java.io.IOException: Unable to establish loopback connection
	at net.filebot.web.WebRequest.httpClient(Unknown Source)
	at net.filebot.web.WebRequest.httpRequestV2(Unknown Source)
	at net.filebot.web.WebRequest.fetch(Unknown Source)
	at net.filebot.CachedResource.lambda$fetchIfModified$13(Unknown Source)
	at net.filebot.CachedResource.lambda$get$0(Unknown Source)
	at net.filebot.CachedResource.retry(Unknown Source)
	at net.filebot.CachedResource.lambda$get$1(Unknown Source)
	at net.filebot.Cache.computeIf(Unknown Source)
	at net.filebot.CachedResource.get(Unknown Source)
	at net.filebot.Resource$Memoized.get(Unknown Source)
	at net.filebot.cli.ScriptBundle.open(Unknown Source)
	at net.filebot.cli.ScriptBundle.getScript(Unknown Source)
	at net.filebot.cli.ScriptShell.runScript(Unknown Source)
	at net.filebot.cli.ArgumentProcessor.runScript(Unknown Source)
	at net.filebot.cli.ArgumentProcessor.run(Unknown Source)
	at net.filebot.Main.main(Unknown Source)
Caused by: java.io.IOException: Unable to establish loopback connection
	... 16 more
Caused by: java.net.SocketException: Invalid argument: connect
	... 16 more

Error (o_O)
The same error occurs when using the above directly from command line

Apologies in advance if I have missed something or done something incorrectly
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: AMC Script error with MS Store app v5.0.3

Post by rednoah »

:idea: I cannot reproduce the issue on my end.


:idea: A Google search for SocketException: Invalid argument: connect and IOException: Unable to establish loopback connection suggests that this is a somewhat obscure network issue on your end, possibly related to IPv6 and/or VPN network configuration:
https://stackoverflow.com/questions/821 ... nt-connect


:arrow: You may be able to work around the issue by forcing IPv4 networking:
rednoah wrote: 30 Jun 2016, 08:36 Force IPv4 network connections: java.net.preferIPv4Stack = false | true

Code: Select all

filebot -script fn:properties --def java.net.preferIPv4Stack=true
:idea: Please read the FAQ and How to Request Help.
paulnd
Posts: 10
Joined: 06 Oct 2013, 15:45

Re: Unable to establish loopback connection

Post by paulnd »

Thanks for your prompt response and suggestion,

MS Store App, forcing IPv4 connections results in the same error

Code: Select all

D:\Kodi Holding>filebot -script fn:properties --def java.net.preferIPv4Stack=true
script_bundle_0_0: compute: fn: net.sf.ehcache.CacheException: java.io.StreamCorruptedException: invalid stream header: 00000000
Failed to fetch resource: https://api.filebot.net/9760/script/fn.jar.xz: Unable to establish loopback connection
Unable to establish loopback connection
java.io.UncheckedIOException: java.io.IOException: Unable to establish loopback connection
        at net.filebot.web.WebRequest.httpClient(Unknown Source)
        at net.filebot.web.WebRequest.httpRequestV2(Unknown Source)
        at net.filebot.web.WebRequest.fetch(Unknown Source)
        at net.filebot.CachedResource.lambda$fetchIfModified$13(Unknown Source)
        at net.filebot.CachedResource.lambda$get$0(Unknown Source)
        at net.filebot.CachedResource.retry(Unknown Source)
        at net.filebot.CachedResource.lambda$get$1(Unknown Source)
        at net.filebot.Cache.computeIf(Unknown Source)
        at net.filebot.CachedResource.get(Unknown Source)
        at net.filebot.Resource$Memoized.get(Unknown Source)
        at net.filebot.cli.ScriptBundle.open(Unknown Source)
        at net.filebot.cli.ScriptBundle.getScript(Unknown Source)
        at net.filebot.cli.ScriptShell.runScript(Unknown Source)
        at net.filebot.cli.ArgumentProcessor.runScript(Unknown Source)
        at net.filebot.cli.ArgumentProcessor.run(Unknown Source)
        at net.filebot.Main.main(Unknown Source)
Caused by: java.io.IOException: Unable to establish loopback connection
        ... 16 more
Caused by: java.net.SocketException: Invalid argument: connect
        ... 16 more

Error (o_O)
As a test, I downloaded and installed the windows installer version from the website and it seems to work even without forcing IPv4 connections, apart from the expected license error.

Code: Select all

Run script [fn:amc] at [Tue May 23 15:17:22 BST 2023]

[PSA] Important Discussion of Proposed Changes:
https://www.filebot.net/forums/viewtopic.php?t=13406

Parameter: clean = y
Invalid usage: --def extras is not used and has no effect
Argument[0]: D:\Kodi Holding\Incoming
Input: D:\Kodi Holding\Incoming\Air.Warriors.S10E01.F-14.Tomcat.1080p.WEB.h264-CAFFEiNE.mkv
Group: {Series=Air} => [Air.Warriors.S10E01.F-14.Tomcat.1080p.WEB.h264-CAFFEiNE.mkv]
Rename episodes using [TheMovieDB] with [Airdate Order]
Lookup via [Air] [Air Warriors]
Fetching episode data for [Air]
?? 15 episodes
Fetching episode data for [Air Warriors]
?? 43 episodes
Whoopsies! --action MOVE requires a valid license.
* Consider using --action TEST
License Error: UNREGISTERED
 ________________________________________________ 
/ Please purchase a FileBot License:             \
\ https://www.filebot.net/purchase.html#msi      /
 ------------------------------------------------ 
      \                             .       .
       \                           / `.   .' " 
        \                  .---.  <    > <    >  .---.
         \                 |    \  \ - ~ ~ - /  /    |
               _____          ..-~             ~-..-~
              |     |   \~~~\.'                    `./~~~/
             ---------   \__/                        \__/
            .'  O    \     /               /       \  " 
           (_____,    `._.'               |         }  \/~~~/
            `----.          /       }     |        /    \__/
                  `-.      |       /      |       /      `. ,~~|
                      ~-.__|      /_ - ~ ^|      /- _      `..-'   
                           |     /        |     /     ~-.     `-. _  _  _
                           |_____|        |_____|         ~ - . _ _ _ _ _>
FileBot requires a valid license. Please run `filebot --license *.psm` to install your FileBot license.
Bad License (>_<)
However if I uninstall the installer version and revert to the MS Store App, the loopback error returns
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Unable to establish loopback connection

Post by rednoah »

You can further set net.filebot.web.WebRequest.v1 to configure FileBot to use the same HTTP/1 code used by default in previous FileBot 4.* releases:

Code: Select all

filebot -script fn:properties --def net.filebot.web.WebRequest.v1=true
:idea: Please read the FAQ and How to Request Help.
paulnd
Posts: 10
Joined: 06 Oct 2013, 15:45

Re: Unable to establish loopback connection

Post by paulnd »

rednoah wrote: 23 May 2023, 15:00 You can further set net.filebot.web.WebRequest.v1 to configure FileBot to use the same HTTP/1 code used by default in previous FileBot 4.* releases:

Code: Select all

filebot -script fn:properties --def net.filebot.web.WebRequest.v1=true
Unfortunately same error

Code: Select all

D:\Kodi Holding>filebot -script fn:properties --def net.filebot.web.WebRequest.v1=true
script_bundle_0_0: compute: fn: net.sf.ehcache.CacheException: java.io.StreamCorruptedException: invalid stream header: 00000000
Failed to fetch resource: https://api.filebot.net/9760/script/fn.jar.xz: Unable to establish loopback connection
Unable to establish loopback connection
java.io.UncheckedIOException: java.io.IOException: Unable to establish loopback connection
        at net.filebot.web.WebRequest.httpClient(Unknown Source)
        at net.filebot.web.WebRequest.httpRequestV2(Unknown Source)
        at net.filebot.web.WebRequest.fetch(Unknown Source)
        at net.filebot.CachedResource.lambda$fetchIfModified$13(Unknown Source)
        at net.filebot.CachedResource.lambda$get$0(Unknown Source)
        at net.filebot.CachedResource.retry(Unknown Source)
        at net.filebot.CachedResource.lambda$get$1(Unknown Source)
        at net.filebot.Cache.computeIf(Unknown Source)
        at net.filebot.CachedResource.get(Unknown Source)
        at net.filebot.Resource$Memoized.get(Unknown Source)
        at net.filebot.cli.ScriptBundle.open(Unknown Source)
        at net.filebot.cli.ScriptBundle.getScript(Unknown Source)
        at net.filebot.cli.ScriptShell.runScript(Unknown Source)
        at net.filebot.cli.ArgumentProcessor.runScript(Unknown Source)
        at net.filebot.cli.ArgumentProcessor.run(Unknown Source)
        at net.filebot.Main.main(Unknown Source)
Caused by: java.io.IOException: Unable to establish loopback connection
        ... 16 more
Caused by: java.net.SocketException: Invalid argument: connect
        ... 16 more

Error (o_O)
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Unable to establish loopback connection

Post by rednoah »

I see now! The custom properties script isn't working in the first place, because the script is not accessible, and so no custom configuration is written or used:

Code: Select all

at net.filebot.web.WebRequest.httpRequestV2(Unknown Source)

:arrow: In this case, you'll have to manually open the application data folder and create a system.properties text file:

Code: Select all

%USERPROFILE%\AppData\Local\Packages\PointPlanck.FileBot_*\LocalCache\Roaming\FileBot
with the following text content:

Code: Select all

#FileBot System Properties
net.filebot.web.WebRequest.v1=true
java.net.preferIPv4Stack=true


EDIT:

This what it looks like for me:

Code: Select all

type "%USERPROFILE%\AppData\Local\Packages\PointPlanck.FileBot_49ex9gnthnt12\LocalCache\Roaming\FileBot\system.properties"
#FileBot System Properties
#Tue May 23 22:28:06 ICT 2023
net.filebot.web.WebRequest.v1=true
java.net.preferIPv4Stack=true
:!: Make sure to delete %APPDATA%/FileBot (application data for the standalone edition) before using / running the Microsoft Store edition, since application sandboxing will transparently redirect File IO and redirect to different folders depending on what already exists.
:idea: Please read the FAQ and How to Request Help.
paulnd
Posts: 10
Joined: 06 Oct 2013, 15:45

Re: Unable to establish loopback connection

Post by paulnd »

Working now, thank you
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Unable to establish loopback connection

Post by rednoah »

paulnd wrote: 23 May 2023, 15:29 Working now, thank you
Cheers! Did you have to set both of these options, or did one of them alone do the job?

(A)

Code: Select all

net.filebot.web.WebRequest.v1=false
java.net.preferIPv4Stack=true
(B)

Code: Select all

net.filebot.web.WebRequest.v1=true
java.net.preferIPv4Stack=false
:idea: Please read the FAQ and How to Request Help.
paulnd
Posts: 10
Joined: 06 Oct 2013, 15:45

Re: Unable to establish loopback connection

Post by paulnd »

There must be some form of persistence because it continues to work even if I delete system.properties, I'll try rebooting between changes and let you know
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Unable to establish loopback connection

Post by rednoah »

The following command will reset all caches, so that FileBot cannot rely on previously cached network response data:

Code: Select all

filebot -clear-cache
:idea: Please read the FAQ and How to Request Help.
paulnd
Posts: 10
Joined: 06 Oct 2013, 15:45

Re: Unable to establish loopback connection

Post by paulnd »

Code: Select all

net.filebot.web.WebRequest.v1=true
is the one that works
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Unable to establish loopback connection

Post by rednoah »

Cheers! Thanks for confirming!
:idea: Please read the FAQ and How to Request Help.
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Unable to establish loopback connection

Post by rednoah »

:arrow: Likely duplicate of "Unable to establish loopback connection" Windows Store v.5.0.3.0.


:arrow: Press WIN+R and then run the following command to configure FileBot to use the legacy HTTP/1 API:

Code: Select all

setx FILEBOT_OPTS "-Dnet.filebot.web.WebRequest.v1=true"
:idea: Please read the FAQ and How to Request Help.
paulnd
Posts: 10
Joined: 06 Oct 2013, 15:45

Re: Unable to establish loopback connection

Post by paulnd »

rednoah wrote: 24 May 2023, 21:52 :arrow: Press WIN+R and then run the following command to configure FileBot to use the legacy HTTP/1 API:

Code: Select all

setx FILEBOT_OPTS "-Dnet.filebot.web.WebRequest.v1=true"
Thank you, confirmed working
Post Reply