portainer/portainer · error
Invalid stack file content
Error message
Invalid stack file content
What it means
Error "Invalid stack file content" thrown in portainer/portainer.
Source
Thrown at api/http/handler/stacks/create_swarm_stack.go:42
// Swarm cluster identifier
SwarmID string `example:"jpofkc0i9uo9wtx1zesuk649w" validate:"required"`
// Content of the Stack file
StackFileContent string `example:"version: 3\n services:\n web:\n image:nginx" validate:"required"`
// A list of environment variables used during stack deployment
Env []portainer.Pair
// Whether the stack is from a app template
FromAppTemplate bool `example:"false"`
}
func (payload *swarmStackFromFileContentPayload) Validate(r *http.Request) error {
if len(payload.Name) == 0 {
return errors.New("Invalid stack name")
}
if len(payload.SwarmID) == 0 {
return errors.New("Invalid Swarm ID")
}
if len(payload.StackFileContent) == 0 {
return errors.New("Invalid stack file content")
}
return nil
}
func createStackPayloadFromSwarmFileContentPayload(name string, swarmID string, fileContent string, env []portainer.Pair, fromAppTemplate bool) stackbuilders.StackPayload {
return stackbuilders.StackPayload{
Name: name,
SwarmID: swarmID,
StackFileContent: []byte(fileContent),
Env: env,
FromAppTemplate: fromAppTemplate,
}
}
// @id StackCreateDockerSwarmString
// @summary Deploy a new swarm stack from a text
// @description Deploy a new stack into a Docker environment specified via the environment identifier.
// @description **Access policy**: authenticatedView on GitHub (pinned to 17e74456ff)
When it happens
Trigger: Thrown at api/http/handler/stacks/create_swarm_stack.go:42 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of portainer/portainer@17e74456ff (2026-08-26).
Data as JSON: /api/errors/5c1bf795f4ec936c.
Report an issue: GitHub.