{"record":{"id":"e8ce82121568b204","repo":"portainer/portainer","slug":"a-stack-with-the-name-s-is-already-running-on-e","errorCode":null,"errorMessage":"A stack with the name '%s' is already running on endpoint '%s'","messagePattern":"A stack with the name '(.+?)' is already running on endpoint '(.+?)'","errorType":"http","errorClass":"httperror.HandlerError","httpStatus":409,"severity":"error","filePath":"api/http/handler/stacks/stack_migrate.go","lineNumber":150,"sourceCode":"\n\tstack.EndpointID = portainer.EndpointID(payload.EndpointID)\n\tif payload.SwarmID != \"\" {\n\t\tstack.SwarmID = payload.SwarmID\n\t}\n\n\toldName := stack.Name\n\tif payload.Name != \"\" {\n\t\tstack.Name = payload.Name\n\t}\n\n\tisUnique, err := handler.checkUniqueStackNameInDocker(targetEndpoint, stack.Name, stack.ID, stack.SwarmID != \"\")\n\tif err != nil {\n\t\treturn httperror.InternalServerError(\"Unable to check for name collision\", err)\n\t}\n\n\tif !isUnique {\n\t\terrorMessage := fmt.Sprintf(\"A stack with the name '%s' is already running on endpoint '%s'\", stack.Name, targetEndpoint.Name)\n\t\treturn httperror.Conflict(errorMessage, errors.New(errorMessage))\n\t}\n\n\tmigrationError := handler.migrateStack(r, stack, targetEndpoint)\n\tif migrationError != nil {\n\t\treturn migrationError\n\t}\n\n\tnewName := stack.Name\n\tstack.Name = oldName\n\tif err := handler.teardownService.RemoveResources(context.TODO(), securityContext.UserID, stack, endpoint); err != nil {\n\t\treturn httperror.InternalServerError(err.Error(), err)\n\t}\n\n\tstack.Name = newName\n\tif err := handler.DataStore.Stack().Update(stack.ID, stack); err != nil {\n\t\treturn httperror.InternalServerError(\"Unable to persist the stack changes inside the database\", err)\n\t}\n","sourceCodeStart":132,"sourceCodeEnd":168,"githubUrl":"https://github.com/portainer/portainer/blob/17e74456ff6e794b9d5439ec3fa06922aa18a3f8/api/http/handler/stacks/stack_migrate.go#L132-L168","documentation":"Error \"A stack with the name '%s' is already running on endpoint '%s'\" thrown in portainer/portainer.","triggerScenarios":"Thrown at api/http/handler/stacks/stack_migrate.go:150 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"17e74456ff6e794b9d5439ec3fa06922aa18a3f8","analyzedAt":"2026-08-26T23:09:01.915Z","schemaVersion":2},"datasetVersion":"2026-08-27T03:17:27.898Z"}