{"id":"780c0f12622de0d7","repo":"gohugoio/hugo","slug":"no-deployment-targets-found","errorCode":null,"errorMessage":"no deployment targets found","messagePattern":"no deployment targets found","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"deploy/deploy.go","lineNumber":82,"sourceCode":"\ttarget *deployconfig.Target // the target to deploy to\n\n\t// For tests...\n\tsummary deploySummary // summary of latest Deploy results\n}\n\ntype deploySummary struct {\n\tNumLocal, NumRemote, NumUploads, NumDeletes int\n}\n\nconst metaMD5Hash = \"md5chksum\" // the meta key to store md5hash in\n\n// New constructs a new *Deployer.\nfunc New(cfg config.AllProvider, logger loggers.Logger, localFs afero.Fs) (*Deployer, error) {\n\tdcfg := cfg.GetConfigSection(deployconfig.DeploymentConfigKey).(deployconfig.DeployConfig)\n\ttargetName := dcfg.Target\n\n\tif len(dcfg.Targets) == 0 {\n\t\treturn nil, errors.New(\"no deployment targets found\")\n\t}\n\tmediaTypes := cfg.GetConfigSection(\"mediaTypes\").(media.Types)\n\n\t// Find the target to deploy to.\n\tvar tgt *deployconfig.Target\n\tif targetName == \"\" {\n\t\t// Default to the first target.\n\t\ttgt = dcfg.Targets[0]\n\t} else {\n\t\tfor _, t := range dcfg.Targets {\n\t\t\tif t.Name == targetName {\n\t\t\t\ttgt = t\n\t\t\t}\n\t\t}\n\t\tif tgt == nil {\n\t\t\treturn nil, fmt.Errorf(\"deployment target %q not found\", targetName)\n\t\t}\n\t}","sourceCodeStart":64,"sourceCodeEnd":100,"githubUrl":"https://github.com/gohugoio/hugo/blob/8a468df065a75c1c7cf9f6850f32148746590ea5/deploy/deploy.go#L64-L100","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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:`."],"exampleFix":"# before (hugo.toml — no deployment section)\n\n# after\n[deployment]\n[[deployment.targets]]\nname = \"production\"\nURL = \"s3://my-bucket?region=us-east-1\"","handlingStrategy":"validation","validationCode":"if len(cfg.Deployment.Targets) == 0 {\n    return errors.New(\"configure at least one [[deployment.targets]] with name and URL before running hugo deploy\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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"],"tags":["hugo","deploy","config"],"analyzedSha":"8a468df065a75c1c7cf9f6850f32148746590ea5","analyzedAt":"2026-07-31T21:23:07.045Z","schemaVersion":2}