portainer/portainer · error

failed to copy config env vars: %w

Error message

failed to copy config env vars: %w

What it means

Error "failed to copy config env vars: %w" thrown in portainer/portainer.

Source

Thrown at api/exec/compose_stack.go:211

	}

	defer logs.CloseAndLogErr(defaultEnvFile)

	if _, err = io.Copy(w, defaultEnvFile); err == nil {
		if _, err = fmt.Fprintf(w, "\n"); err != nil {
			return fmt.Errorf("failed to copy default env file: %w", err)
		}
	}

	return nil
	// If couldn't copy the .env file, then ignore the error and try to continue
}

// copyConfigEnvVars write the environment variables from stack configuration to the writer
func copyConfigEnvVars(w io.Writer, envs []portainer.Pair) error {
	for _, v := range envs {
		if _, err := fmt.Fprintf(w, "%s=%s\n", v.Name, v.Value); err != nil {
			return fmt.Errorf("failed to copy config env vars: %w", err)
		}
	}

	return nil
}

View on GitHub (pinned to 17e74456ff)

When it happens

Trigger: Thrown at api/exec/compose_stack.go:211 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/fe2b30ab060e4635. Report an issue: GitHub.