-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error = failed to retrieve local environment: failed to find local environment #12285
Comments
I had the same issue after upgrading to 2.22.0. Not sure if it's related to the method of attaching the environment or something else. I was able to stop getting this error after I removed the environment and added it back (I am using the Portainer Agent method). Edit: After a long power outage from Hurricane Milton, I just got my environment back online and it has started giving this error message again. No idea what caused it to go away before, but I have tried all previous steps and the error persists. It doesn't seem to affect anything other than being an annoyance. |
Same errors "Failed to find local environment" here after update from 2.21.2 to 2.22.0, although I am still able to connect to and control my agents. Removing and adding back did not resolve for me. |
I tried removing the environment and adding it back and that did NOT fix it. |
Same here, I do have Docker and Kubernetes. Also, using enterprise edition. |
Maybe I just got lucky, but I can't think of anything else I did other than removing and then re-adding the environment. I think I tried adding via socket after removing the environment the first time, but it only showed the local node (not all swarm members), so I removed that environment and went back to adding the environment via agent. I know this is a basic thing to check, but just want to be sure for those of you still having this issue: Did you also make sure to upgrade your Portainer agent to 2.22.0 (not Portainer itself, but the actual agent that runs on all nodes)? Sometimes the :latest tag doesn't pull the actual latest release, so I would make sure to specify the 2.22.0 tag when pulling the image. |
@XBadFellaX removing and adding environment is works for me. |
Same issue here after upgrading portainer-ce to 2.22.0 (standalone docker hosts only here) The errors popped every couple mins, but they don't appear in console of portainer-ce or agent. The errors seem to have stopped after I added local Environment using Socket. I didn't need to remove my existing local Environment ( I waited a couple mins, then removed the Socket Environment ( Maybe it's some upgrade task (run once after upgrade) that is hardcoded with |
How does one do this with socket-proxy? I am using Socket proxy instead of ///var/run/docker.sock. I have it added via agent with the URL socket-proxy:2375. Do I need to do something different? |
`services: Portainer - WebUI for Containersportainer: Here's my compose. |
I completely rebuilt portainer from scratch. Everything was fine with multiple environments for a day. upgrade portainer: issue manifests curl 'https://example.invalid/api/system/info' \
-H 'accept: application/json, text/plain, */*' \
-H 'accept-language: en-GB,en;q=0.8' \
-H 'cookie: portainer_api_key=REDACTED' \
-H 'priority: u=1, i' \
-H 'referer: https://example.invalid/' \
-H 'sec-ch-ua: "Brave";v="129", "Not=A?Brand";v="8", "Chromium";v="129"' \
-H 'sec-ch-ua-mobile: ?0' \
-H 'sec-ch-ua-platform: "macOS"' \
-H 'sec-fetch-dest: empty' \
-H 'sec-fetch-mode: cors' \
-H 'sec-fetch-site: same-origin' \
-H 'sec-gpc: 1' \
-H 'user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36' \
-H 'x-csrf-token: REDACTED'
{"message":"Failed to get platform","details":"Failed to find local environment"} |
Anyone know how to add using socket when using socket proxy? |
In my case, I don't even have a local environment. I am running portainer-ce in Kubernetes and only connecting to a portainer agent to control a standalone docker instance. I do not use it to manage the local K8s environment, nor do I want to. This error doesn't seem to break any functionality, but it is annoying. |
I confirm that after removing all environments and adding them back, I still get the error message. |
I had mine working and posted what worked for me, but now it has returned. After a long power outage from Hurricane Milton, I just got my environment back online and it has started giving this error message again. No idea what caused it to go away before, but I have tried all previous steps and the error persists. It doesn't seem to affect anything other than being an annoyance. |
Updated to 2.23.0 but error does NOT stop. |
Also having the same issue running portainer through docker compose and only a single environment. This started when I upgraded to 2.23.0. I can't figure out why it's doing this suddenly as all containers seem to be ok. |
Hi all, I am going to look into replicating this and raising with the team. |
The error can be replicated by having at least 1 environment configured and no local environment configured. It was introduced in 6f84317 in portainer/api/platform/service.go Line 100 in 6f84317
The error text was updated in 80f53ed to the current message: portainer/api/platform/service.go Line 105 in 80f53ed
This commit also added a condition to suppress any error when no environments are configured: portainer/api/platform/service.go Line 84 in 80f53ed
Since having no local environment is also valid, presumably we just need to do the same thing and In my case, Portainer runs in Kubernetes and only has a remote agent environment. |
|
That's good information hhromic. I would like to point out though for the portainer team that I am not using swarm and just standalone env, similar to most of the users that reported that same issue. |
Downgrade until this regression is fixed portainer/portainer#12285
Upgraded to 2.24.0 but the error is still NOT resolved. @Nick-Portainer any success? The constant error is very annoying. |
Adding a local (socket) environment fixed it for me. Previously there was just an a agent environment connected. |
This is true, but it should not be necessary to mount a local socket if you only want to manage agent(s). |
It absolutely shouldn't be necessary, but it's only temporary. I got it to work by adding it and then removing it. Then the errors stop, even after the socket environment has been removed. I started getting the error again after another update, but found that the key is to add via socket, connect to the socket environment, then you can remove the socket environment. I kept the socket environment for about a day before removing it because one of my environments didn't "take" if it wasn't connected for a bit. I think the main thing is to switch to the socket at least once after adding it. Ultimately, this needs to be fixed. But this is a workaround if you're able to do it in your environment. |
My solution is to stick with the LTS version. I can't add a socket environment like that with Kubernetes. Even if I could that would then exceed my license count. |
Updated to 2.24.1 but the error still does NOT go away. My logs are full of these errors now. |
100% agree, this worked for me but it uses up a license slot to get rid of that annoying message at least ad an option to disable the message and update the error message to reference it. |
same for me. Before updating to 2.24.1 all was fine. Now it's really annoying. :/ |
This issue still exists in the latest 2.25.1 version of Portainer. |
Can confirm. Issue still exists in 2.25.1. I also have portainer-ee running on a K3S kubernetes host so there is no local environment I could configure for this to use. And if I do I'd get a license problem in my current environment. So please fix this issue! |
fix please the issue |
Before you start please confirm the following.
Problem Description
Getting these errors after update to 2.22.0
2024/10/03 02:31AM WRN github.com/portainer/portainer-ee/api/docker/local.go:79 > failed to clean up updater stack | error="failed to retrieve local environment: failed to find local environment" retry time=2 stack_trace=[{"func":"cleanUpGhostUpdaterStacks.ScanAndCleanUpGhostUpdaterContainers.func1","line":"21","source":"local.go"},{"func":"Retry","line":"74","source":"local.go"},{"func":"cleanUpGhostUpdaterStacks","line":"434","source":"main.go"},{"func":"goexit","line":"1695","source":"asm_amd64.s"}]
2024/10/03 02:32AM WRN github.com/portainer/portainer-ee/api/cmd/portainer/main.go:435 > unable to clean up ghost updater stack | error="failed to retrieve local environment: failed to find local environment" stack_trace=[{"func":"cleanUpGhostUpdaterStacks.ScanAndCleanUpGhostUpdaterContainers.func1","line":"21","source":"local.go"},{"func":"Retry","line":"74","source":"local.go"},{"func":"cleanUpGhostUpdaterStacks","line":"434","source":"main.go"},{"func":"goexit","line":"1695","source":"asm_amd64.s"}]
Expected Behavior
No Error
Actual Behavior
2024/10/03 02:31AM WRN github.com/portainer/portainer-ee/api/docker/local.go:79 > failed to clean up updater stack | error="failed to retrieve local environment: failed to find local environment" retry time=2 stack_trace=[{"func":"cleanUpGhostUpdaterStacks.ScanAndCleanUpGhostUpdaterContainers.func1","line":"21","source":"local.go"},{"func":"Retry","line":"74","source":"local.go"},{"func":"cleanUpGhostUpdaterStacks","line":"434","source":"main.go"},{"func":"goexit","line":"1695","source":"asm_amd64.s"}]
2024/10/03 02:32AM WRN github.com/portainer/portainer-ee/api/cmd/portainer/main.go:435 > unable to clean up ghost updater stack | error="failed to retrieve local environment: failed to find local environment" stack_trace=[{"func":"cleanUpGhostUpdaterStacks.ScanAndCleanUpGhostUpdaterContainers.func1","line":"21","source":"local.go"},{"func":"Retry","line":"74","source":"local.go"},{"func":"cleanUpGhostUpdaterStacks","line":"434","source":"main.go"},{"func":"goexit","line":"1695","source":"asm_amd64.s"}]
Steps to Reproduce
Go to Portainer
Login
Check Logs
Portainer logs or screenshots
2024/10/03 02:31AM WRN github.com/portainer/portainer-ee/api/docker/local.go:79 > failed to clean up updater stack | error="failed to retrieve local environment: failed to find local environment" retry time=2 stack_trace=[{"func":"cleanUpGhostUpdaterStacks.ScanAndCleanUpGhostUpdaterContainers.func1","line":"21","source":"local.go"},{"func":"Retry","line":"74","source":"local.go"},{"func":"cleanUpGhostUpdaterStacks","line":"434","source":"main.go"},{"func":"goexit","line":"1695","source":"asm_amd64.s"}]
2024/10/03 02:32AM WRN github.com/portainer/portainer-ee/api/cmd/portainer/main.go:435 > unable to clean up ghost updater stack | error="failed to retrieve local environment: failed to find local environment" stack_trace=[{"func":"cleanUpGhostUpdaterStacks.ScanAndCleanUpGhostUpdaterContainers.func1","line":"21","source":"local.go"},{"func":"Retry","line":"74","source":"local.go"},{"func":"cleanUpGhostUpdaterStacks","line":"434","source":"main.go"},{"func":"goexit","line":"1695","source":"asm_amd64.s"}]
Portainer version
2.22.0
Portainer Edition
Business Edition (BE/EE) with 5NF / 3NF license
Platform and Version
Docker 27.3.1
OS and Architecture
Ubuntu 24.04
Browser
Chrome 129
What command did you use to deploy Portainer?
No response
Additional Information
No response
The text was updated successfully, but these errors were encountered: