gohugoio/hugo · error

no deployment targets found

Error message

no deployment targets found

What it means

The Deployer constructor requires at least one entry in deployment.targets. With an empty targets list, New returns this error immediately because there is nowhere to deploy to.

Solutions

  1. Add a [[deployment.targets]] entry with name and url to your config.
  2. Verify the deployment config key spelling and that the config file is being loaded (check `hugo config`).
  3. For multiple environments, ensure the targets are defined in the active config (e.g. config/production).

Example fix

// before
# no deployment config
hugo deploy
// after
# hugo.toml
[[deployment.targets]]
name = "mybucket"
url = "s3://my-bucket?region=us-east-1"
hugo deploy
Defensive patterns

Strategy: validation

Validate before calling

// Ensure at least one deployment target is configured
targets := viper.GetStringMap("deployment.targets")
if len(targets) == 0 {
    return errors.New("configure at least one [[deployment.targets]] entry")
}

Prevention

When it happens

Trigger: Running `hugo deploy` with no [[deployment.targets]] table, or a deployment config section that did not load (typo, wrong environment).

Common situations: Missing deployment configuration entirely; the deployment config key misspelled; running deploy in an environment whose config split omits the targets.

Related errors


AI-assisted analysis of gohugoio/hugo@52c9bd7908 (2026-08-09). Data as JSON: /api/errors/780c0f12622de0d7. Report an issue: GitHub.

Appendix: source

Thrown at deploy/deploy.go:82

	target *deployconfig.Target // the target to deploy to

	// For tests...
	summary deploySummary // summary of latest Deploy results
}

type deploySummary struct {
	NumLocal, NumRemote, NumUploads, NumDeletes int
}

const metaMD5Hash = "md5chksum" // the meta key to store md5hash in

// New constructs a new *Deployer.
func New(cfg config.AllProvider, logger loggers.Logger, localFs afero.Fs) (*Deployer, error) {
	dcfg := cfg.GetConfigSection(deployconfig.DeploymentConfigKey).(deployconfig.DeployConfig)
	targetName := dcfg.Target

	if len(dcfg.Targets) == 0 {
		return nil, errors.New("no deployment targets found")
	}
	mediaTypes := cfg.GetConfigSection("mediaTypes").(media.Types)

	// Find the target to deploy to.
	var tgt *deployconfig.Target
	if targetName == "" {
		// Default to the first target.
		tgt = dcfg.Targets[0]
	} else {
		for _, t := range dcfg.Targets {
			if t.Name == targetName {
				tgt = t
			}
		}
		if tgt == nil {
			return nil, fmt.Errorf("deployment target %q not found", targetName)
		}
	}

View on GitHub (pinned to 52c9bd7908)