Stack already exists

If you encounter an error message from Portainer stating that a stack with the specified or normalized name 'helmut4' already exists, you might need to address the issue on the server-side.

This issue can arise if Portainer running version 2.9 or earlier has been upgraded to a newer version. In previous versions, it was permissible to create stacks with uppercase letters, such as "Helmut4." However, this functionality has been modified, and only lowercase characters are now permitted, resulting in the name "helmut4."

Please exercise caution, as the following steps may result in data loss, corruption, or other unexpected issues.

Proceed only if you are thoroughly acquainted with the task and are fully aware of the potential risks.

MoovIT cannot be held liable for any damage caused by customer error.

Consult our support team if you require assistance in carrying out this procedure.

If the matching stack is not visible in the GUI, it is necessary to connect to the host and delete the stack from there.

Establish an SSH or terminal connection to the server and utilize sudo privileges to perform the necessary actions.

Before proceeding with the following commands, ensure that the httpie and jq utilities are installed on your system.

For detailed installation instructions, please refer to the Helmut4 installation guide.

Connect to Portainer and list 'helmut4' stack

# Set portainer port
PORTAINER_PORT=9000

# Get JWT token - replace the PASSWORD
JWT=$(http POST :${PORTAINER_PORT}/api/auth Username="admin" Password="admin" | jq -r '.jwt')

# Request stacks with name helmut4 or Helmut4
http --verify=no --form GET :${PORTAINER_PORT}/api/stacks X-API-Key: "Authorization: Bearer ${JWT}" | jq '.[] | select(.Name | ascii_downcase == "helmut4")'

The last command should return a response similar to the screenshot below. Verify if the name is 'helmut4' and jot down the ID and EndpointID before proceeding further.

List all available stacks (optional)

If the expected 'helmut4' stack is not present, list all active stacks using the following command:

# List all available stacks
http --verify=no --form GET :${PORTAINER_PORT}/api/stacks X-API-Key: "Authorization: Bearer ${JWT}"

Delete stack by ID & EndpointID

To delete the dedicated 'helmut4' stack, you need the ID & EndpointID. Please replace those in the given command below to match your environment.

# Delete stack
http --verify=no --form DELETE :${PORTAINER_PORT}/api/stacks/?endpointId= X-API-Key: "Authorization: Bearer ${JWT}"

You can confirm the success of the command by reattempting to list the "helmut4" stack. If the command was successful, you should not see any output in the terminal.