{"record":{"id":"acb91945c825ba21","repo":"portainer/portainer","slug":"stack-management-is-disabled-for-non-admin-users-acb919","errorCode":null,"errorMessage":"Stack management is disabled for non-admin users","messagePattern":"Stack management is disabled for non-admin users","errorType":"http","errorClass":"httperror.HandlerError","httpStatus":403,"severity":"error","filePath":"api/http/handler/stacks/stack_inspect.go","lineNumber":66,"sourceCode":"\t\treturn httperror.InternalServerError(\"Unable to retrieve info from request context\", err)\n\t}\n\n\tendpoint, err := handler.DataStore.Endpoint().Endpoint(stack.EndpointID)\n\tif handler.DataStore.IsErrObjectNotFound(err) {\n\t\tif !securityContext.IsAdmin {\n\t\t\treturn httperror.NotFound(\"Unable to find an environment with the specified identifier inside the database\", err)\n\t\t}\n\t} else if err != nil {\n\t\treturn httperror.InternalServerError(\"Unable to find an environment with the specified identifier inside the database\", err)\n\t}\n\n\tcanManage, err := handler.userCanManageStacks(securityContext, endpoint)\n\tif err != nil {\n\t\treturn httperror.InternalServerError(\"Unable to verify user authorizations to validate stack deletion\", err)\n\t}\n\tif !canManage {\n\t\terrMsg := \"Stack management is disabled for non-admin users\"\n\t\treturn httperror.Forbidden(errMsg, errors.New(errMsg))\n\t}\n\n\tif endpoint != nil {\n\t\terr = handler.requestBouncer.AuthorizedEndpointOperation(r, endpoint)\n\t\tif err != nil {\n\t\t\treturn httperror.Forbidden(\"Permission denied to access environment\", err)\n\t\t}\n\n\t\tif stack.Type == portainer.DockerSwarmStack || stack.Type == portainer.DockerComposeStack {\n\t\t\tresourceControl, err := handler.DataStore.ResourceControl().ResourceControlByResourceIDAndType(stackutils.ResourceControlID(stack.EndpointID, stack.Name), portainer.StackResourceControl)\n\t\t\tif err != nil {\n\t\t\t\treturn httperror.InternalServerError(\"Unable to retrieve a resource control associated to the stack\", err)\n\t\t\t}\n\n\t\t\taccess, err := handler.userCanAccessStack(securityContext, resourceControl)\n\t\t\tif err != nil {\n\t\t\t\treturn httperror.InternalServerError(\"Unable to verify user authorizations to validate stack access\", err)\n\t\t\t}","sourceCodeStart":48,"sourceCodeEnd":84,"githubUrl":"https://github.com/portainer/portainer/blob/17e74456ff6e794b9d5439ec3fa06922aa18a3f8/api/http/handler/stacks/stack_inspect.go#L48-L84","documentation":"Error \"Stack management is disabled for non-admin users\" thrown in portainer/portainer.","triggerScenarios":"Thrown at api/http/handler/stacks/stack_inspect.go:66 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"}