hashicorp/packer · error
Unknown data source %s
Error message
Unknown data source %s
What it means
MapOfDatasource.Start returns this error when the requested data source name is not registered in the map. It means a data block in the template references a data source plugin Packer does not know about.
Source
Thrown at packer/maps.go:107
}
return res
}
type MapOfDatasource map[string]func() (packersdk.Datasource, error)
func (mod MapOfDatasource) Has(dataSource string) bool {
_, res := mod[dataSource]
return res
}
func (mod MapOfDatasource) Set(dataSource string, starter func() (packersdk.Datasource, error)) {
mod[dataSource] = starter
}
func (mod MapOfDatasource) Start(dataSource string) (packersdk.Datasource, error) {
d, found := mod[dataSource]
if !found {
return nil, fmt.Errorf("Unknown data source %s", dataSource)
}
return d()
}
func (mod MapOfDatasource) List() []string {
res := []string{}
for k := range mod {
res = append(res, k)
}
return res
}
View on GitHub (pinned to eb36e3c3e4)
Solutions
- Correct the data source type in the template.
- Run `packer init .` so the data source plugin is installed.
- Verify the plugin binary exists with the correct packer-plugin-* naming.
- In embedded Go usage, call Set() for the data source before Start().
Example fix
// before
data "htpp" { ... }
// after
data "http" { ... } Defensive patterns
Strategy: validation
Validate before calling
if !dataSources.Has(name) {
return fmt.Errorf("data source %q not installed; known: %v", name, dataSources.List())
}
ds, err := dataSources.Start(name) Try / catch
if err != nil {
if strings.Contains(err.Error(), "Unknown data source") { /* run packer init */ }
} Prevention
- Declare data source plugins in required_plugins and run `packer init`.
- Cross-check data block types against plugin documentation.
- Use `packer validate` in CI to fail fast on unknown data sources.
When it happens
Trigger: Calling Start(dataSource) with an unregistered name: a data block type misspelled (e.g. "http" vs "curl"), a data source plugin not installed via `packer init`, or Start invoked before Set() registration in embedded usage.
Common situations: Typo in a data block's type attribute; using a third-party data source without declaring it in required_plugins; plugin binary missing from the plugin directory; casing mismatch (lookup is case-sensitive).
Related errors
- The `bucket_name` must be specified
- `channel` is currently a required field.
- the `url` must be specified
- Unknown provisioner %s
- Unknown post-processor %s
AI-assisted analysis of hashicorp/packer@eb36e3c3e4 (2026-09-05).
Data as JSON: /api/errors/6677a667b4e4c64a.
Report an issue: GitHub.