{"record":{"id":"780c0f12622de0d7","repo":"gohugoio/hugo","slug":"no-deployment-targets-found","errorCode":null,"errorMessage":"no deployment targets found","messagePattern":"no deployment targets found","errorType":"validation","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/52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2/deploy/deploy.go#L64-L100","documentation":"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.","triggerScenarios":"Running `hugo deploy` with no [[deployment.targets]] table, or a deployment config section that did not load (typo, wrong environment).","commonSituations":"Missing deployment configuration entirely; the deployment config key misspelled; running deploy in an environment whose config split omits the targets.","solutions":["Add a [[deployment.targets]] entry with name and url to your config.","Verify the deployment config key spelling and that the config file is being loaded (check `hugo config`).","For multiple environments, ensure the targets are defined in the active config (e.g. config/production)."],"exampleFix":"// before\n# no deployment config\nhugo deploy\n// after\n# hugo.toml\n[[deployment.targets]]\nname = \"mybucket\"\nurl = \"s3://my-bucket?region=us-east-1\"\nhugo deploy","handlingStrategy":"validation","validationCode":"// Ensure at least one deployment target is configured\ntargets := viper.GetStringMap(\"deployment.targets\")\nif len(targets) == 0 {\n    return errors.New(\"configure at least one [[deployment.targets]] entry\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Add a [[deployment.targets]] entry with name and url before deploying.","Confirm the config file is loaded (hugo config).","Keep deployment targets in the active environment config."],"tags":["hugo","deploy","config","cli"],"backgroundTag":null,"analyzedSha":"52c9bd7908b4d02d4d0ff8f82a888834d6ee10d2","analyzedAt":"2026-08-09T21:49:36.660Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}