gohugoio/hugo · error
no deployment targets found
Error message
no deployment targets found
What it means
Raised in deploy.New (deploy/deploy.go:82) when the decoded deployment config has zero `[[deployment.targets]]` entries. `hugo deploy` cannot do anything without at least one target bucket/URL, so the Deployer constructor fails immediately.
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 8a468df065)
Solutions
- Add a target to your config: `[[deployment.targets]]` with `name` and `URL` (e.g. an s3://, gs://, or azblob:// URL).
- If your deployment config is under config/production/, run with `--environment production` (the default for `hugo deploy`) or move it to the environment you build with.
- In TOML ensure double brackets (`[[deployment.targets]]`), and in YAML ensure `targets:` is a list nested under `deployment:`.
Example fix
# before (hugo.toml — no deployment section) # after [deployment] [[deployment.targets]] name = "production" URL = "s3://my-bucket?region=us-east-1"
Defensive patterns
Strategy: validation
Validate before calling
if len(cfg.Deployment.Targets) == 0 {
return errors.New("configure at least one [[deployment.targets]] with name and URL before running hugo deploy")
} Prevention
- Define at least one [[deployment.targets]] block (name + URL) in hugo.toml before invoking `hugo deploy`
- Check that the deployment section lives in the config environment you're building with (e.g. config/production)
- In deploy scripts, grep/parse the config for deployment.targets and fail early with a clear message
When it happens
Trigger: Running `hugo deploy` when the site config has no `[[deployment.targets]]` section at all, or when the section is mis-nested/misspelled so it decodes to an empty slice.
Common situations: First-time `hugo deploy` before configuring deployment; config split across files/environments where the deployment section lives in an environment config (e.g. config/production/) but Hugo is run in another environment; using `targets` as a plain table instead of an array-of-tables in TOML; YAML indentation putting targets outside the deployment key.
Related errors
- deployment target %q not found
- language %q not found
- unsupported format: %q
- deploy not supported in this version of Hugo; install a rele
- failed to create workingDir: %w
AI-assisted analysis of gohugoio/hugo@8a468df065 (2026-07-31).
Data as JSON: /data/errors/780c0f12622de0d7.json.
Report an issue: GitHub ↗.