# Could not find a good candidate within 1 attempts at load balancing. \[PC01\] instance refused connection

**URL:** <https://community.fly.io/t/could-not-find-a-good-candidate-within-1-attempts-at-load-balancing-pc01-instance-refused-connection/25579>\
**Category:** General\
**Tags:** proxy, login-only\
**Created:** [August 5, 2025, 8:57pm UTC](https://community.fly.io/t/could-not-find-a-good-candidate-within-1-attempts-at-load-balancing-pc01-instance-refused-connection/25579 "2025-08-05T20:57:24Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![oteiza-a](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/oteiza-a/32/35371_2.png) [@oteiza-a](https://community.fly.io/u/oteiza-a)\
**Post date:** [August 5, 2025, 8:57pm UTC](https://community.fly.io/t/could-not-find-a-good-candidate-within-1-attempts-at-load-balancing-pc01-instance-refused-connection/25579/1 "2025-08-05T20:57:24Z")

</div>

I’m getting these errors in production:

```auto
proxy[d8d9790b279548] den [error] [PR03] could not find a good candidate within 1 attempts at load balancing. last error: [PC01] instance refused connection. is your app listening on 0.0.0.0:8081? make sure it is not only listening on 127.0.0.1 (hint: look at your startup logs, servers often print the address they are listening on)

```

I haven’t changed anything in the toml file or similar, any insights about the cause?

---

<div class="post-metadata">

**Author:** ![mayailurus](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/mayailurus/32/17593_2.png) [@mayailurus](https://community.fly.io/u/mayailurus)\
**Post date:** [August 5, 2025, 9:22pm UTC](https://community.fly.io/t/could-not-find-a-good-candidate-within-1-attempts-at-load-balancing-pc01-instance-refused-connection/25579/3 "2025-08-05T21:22:23Z")

</div>

Hi… Typically you would SSH in at this point and then try to connect to `localhost:8081` via `curl` and/or use `ss -tpnl` to see all listening processes.

(This assumes an HTTP service, of course.)

On Debian, `ss` is in the `iproute2` package.

---

<div class="post-metadata">

**Author:** ![oteiza-a](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/oteiza-a/32/35371_2.png) [@oteiza-a](https://community.fly.io/u/oteiza-a)\
**Post date:** [August 6, 2025, 12:54am UTC](https://community.fly.io/t/could-not-find-a-good-candidate-within-1-attempts-at-load-balancing-pc01-instance-refused-connection/25579/4 "2025-08-06T00:54:45Z")

</div>

Done, I checked that it’s running in 8080:  
 ![Screenshot 2025-08-05 at 8.53.30 PM](https://global.discourse-cdn.com/fly1/original/3X/c/7/c76960b96033cea2ae2cf9035c62e913f0fb0d75.png)

For some reason, deployment logs still says:

```auto
2025-08-06T00:49:10.455 proxy[2866994fe413e8] den [error] [PC01] instance refused connection. is your app listening on 0.0.0.0:8080? make sure it is not only listening on 127.0.0.1 (hint: look at your startup logs, servers often print the address they are listening on)

```

---

<div class="post-metadata">

**Author:** ![mayailurus](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/mayailurus/32/17593_2.png) [@mayailurus](https://community.fly.io/u/mayailurus)\
**Post date:** [August 6, 2025, 1:08am UTC](https://community.fly.io/t/could-not-find-a-good-candidate-within-1-attempts-at-load-balancing-pc01-instance-refused-connection/25579/5 "2025-08-06T01:08:29Z")

</div>

Hm… The other Machine was saying port 808 **1**. What does your `fly.toml` look like?

* * *

Also, it probably help to post the outputs of `fly m list` and `fly services list`, so we in the forum have a better idea of what regions you’re in, and the like…

---

<div class="post-metadata">

**Author:** ![oteiza-a](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/oteiza-a/32/35371_2.png) [@oteiza-a](https://community.fly.io/u/oteiza-a)\
**Post date:** [August 6, 2025, 1:22am UTC](https://community.fly.io/t/could-not-find-a-good-candidate-within-1-attempts-at-load-balancing-pc01-instance-refused-connection/25579/6 "2025-08-06T01:22:44Z")

</div>

yeah I changed all the config to 8080

[env]  
PORT = ‘8080’

…

[http\_service]  
internal\_port = 8080

…

[[services]]  
internal\_port = 8080  
protocol = “tcp”

---

<div class="post-metadata">

**Author:** ![oteiza-a](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/oteiza-a/32/35371_2.png) [@oteiza-a](https://community.fly.io/u/oteiza-a)\
**Post date:** [August 6, 2025, 1:27am UTC](https://community.fly.io/t/could-not-find-a-good-candidate-within-1-attempts-at-load-balancing-pc01-instance-refused-connection/25579/7 "2025-08-06T01:27:45Z")

</div>

> [@mayailurus](#):
>
> fly services list

Here are my services list:

```auto
Services
PROTOCOL PORTS HANDLERS FORCE HTTPS PROCESS GROUP REGIONS MACHINES 
TCP 80 => 8080 [HTTP] True app scl,den,cdg,otp,bom 7       
TCP 443 => 8080 [HTTP,TLS] False app scl,den,cdg,otp,bom 7       
TCP 80 => 8080 [HTTP] False app scl,den,cdg,otp,bom 7       
TCP 443 => 8080 [TLS,HTTP] False app scl,den,cdg,otp,bom 7       

```

---

<div class="post-metadata">

**Author:** ![mayailurus](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/mayailurus/32/17593_2.png) [@mayailurus](https://community.fly.io/u/mayailurus)\
**Post date:** [August 6, 2025, 1:28am UTC](https://community.fly.io/t/could-not-find-a-good-candidate-within-1-attempts-at-load-balancing-pc01-instance-refused-connection/25579/8 "2025-08-06T01:28:25Z")

</div>

Having both `[http_service]` and `[[services]]` define the same port often (randomly) confuses the Fly.io infrastructure.

Try removing `[[services]]` entirely…

(And merge any config knobs into the surviving stanza, of course, 😅.)

---

<div class="post-metadata">

**Author:** ![oteiza-a](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/oteiza-a/32/35371_2.png) [@oteiza-a](https://community.fly.io/u/oteiza-a)\
**Post date:** [August 6, 2025, 1:45am UTC](https://community.fly.io/t/could-not-find-a-good-candidate-within-1-attempts-at-load-balancing-pc01-instance-refused-connection/25579/9 "2025-08-06T01:45:38Z")

</div>

Yeah in my desperation I tried adding the [[services]] config, now I tried without it again and I still get the error log in the machines when deploying:

```auto
2025-08-06T01:42:41.017 proxy[d8d9790b279548] scl [error] [PR03] could not find a good candidate within 1 attempts at load balancing. last error: [PC01] instance refused connection. is your app listening on 0.0.0.0:8080? make sure it is not only listening on 127.0.0.1 (hint: look at your startup logs, servers often print the address they are listening on)

```

---

<div class="post-metadata">

**Author:** ![mayailurus](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/mayailurus/32/17593_2.png) [@mayailurus](https://community.fly.io/u/mayailurus)\
**Post date:** [August 6, 2025, 1:56am UTC](https://community.fly.io/t/could-not-find-a-good-candidate-within-1-attempts-at-load-balancing-pc01-instance-refused-connection/25579/10 "2025-08-06T01:56:23Z")

</div>

Are you able to get any requests through at all, or is it always these errors?

---

<div class="post-metadata">

**Author:** ![oteiza-a](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/oteiza-a/32/35371_2.png) [@oteiza-a](https://community.fly.io/u/oteiza-a)\
**Post date:** [August 6, 2025, 2:02am UTC](https://community.fly.io/t/could-not-find-a-good-candidate-within-1-attempts-at-load-balancing-pc01-instance-refused-connection/25579/11 "2025-08-06T02:02:37Z")

</div>

That’s the weird part, the requests and app work regardless, but I’ve been having 504 errors from the API and I’m suspecting it could be because of this.

---

<div class="post-metadata">

**Author:** ![mayailurus](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/mayailurus/32/17593_2.png) [@mayailurus](https://community.fly.io/u/mayailurus)\
**Post date:** [August 6, 2025, 2:24am UTC](https://community.fly.io/t/could-not-find-a-good-candidate-within-1-attempts-at-load-balancing-pc01-instance-refused-connection/25579/12 "2025-08-06T02:24:22Z")

</div>

There have been false positives with similar messages reported in the forum in the past:

[https://community.fly.io/t/litefs-warning-the-app-is-not-listening-on-the-expected-address-and-will-not-be-reachable/21311](https://community.fly.io/t/litefs-warning-the-app-is-not-listening-on-the-expected-address-and-will-not-be-reachable/21311)

The API anomalies might not be related (although possibly I’m misunderstanding what you’re referring to there).

If the app that you’re getting these errors in doesn’t use volumes, then I would try destroying the two Machines that have been mentioned in the logs so far (`d8d9790b279548` and `2866994fe413e8`)—and then recreating them.

More broadly, see if there’s _some_ correlation with Machines, regions, and the like…

You can use the client-side `Fly-Prefer-Region` and `Fly-Force-Instance-Id` headers to [steer requests](https://fly.io/docs/networking/dynamic-request-routing/#alternative-routing-headers) to particular locales.

```plaintext
$ curl -i -H 'Fly-Prefer-Region: otp' -H 'flyio-debug: doit' 'https://debug.fly.dev/'

```

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/fly1/original/3X/6/e/6e8955d00cb218e186ebbe3a6ab06fefdce15290.svg) [@system](https://community.fly.io/u/system)\
**Post date:** [August 13, 2025, 2:24am UTC](https://community.fly.io/t/could-not-find-a-good-candidate-within-1-attempts-at-load-balancing-pc01-instance-refused-connection/25579/13 "2025-08-13T02:24:24Z")

</div>

Closed on August 13, 2025, 2:24am UTC

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