{"record":{"id":"6677a667b4e4c64a","repo":"hashicorp/packer","slug":"unknown-data-source-s","errorCode":null,"errorMessage":"Unknown data source %s","messagePattern":"Unknown data source (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packer/maps.go","lineNumber":107,"sourceCode":"\t}\n\treturn res\n}\n\ntype MapOfDatasource map[string]func() (packersdk.Datasource, error)\n\nfunc (mod MapOfDatasource) Has(dataSource string) bool {\n\t_, res := mod[dataSource]\n\treturn res\n}\n\nfunc (mod MapOfDatasource) Set(dataSource string, starter func() (packersdk.Datasource, error)) {\n\tmod[dataSource] = starter\n}\n\nfunc (mod MapOfDatasource) Start(dataSource string) (packersdk.Datasource, error) {\n\td, found := mod[dataSource]\n\tif !found {\n\t\treturn nil, fmt.Errorf(\"Unknown data source %s\", dataSource)\n\t}\n\treturn d()\n}\n\nfunc (mod MapOfDatasource) List() []string {\n\tres := []string{}\n\tfor k := range mod {\n\t\tres = append(res, k)\n\t}\n\treturn res\n}\n","sourceCodeStart":89,"sourceCodeEnd":119,"githubUrl":"https://github.com/hashicorp/packer/blob/eb36e3c3e48a036f3e8cc94087636ee72e1303c9/packer/maps.go#L89-L119","documentation":"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.","triggerScenarios":"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.","commonSituations":"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).","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()."],"exampleFix":"// before\ndata \"htpp\" { ... }\n\n// after\ndata \"http\" { ... }","handlingStrategy":"validation","validationCode":"if !dataSources.Has(name) {\n    return fmt.Errorf(\"data source %q not installed; known: %v\", name, dataSources.List())\n}\nds, err := dataSources.Start(name)","typeGuard":null,"tryCatchPattern":"if err != nil {\n    if strings.Contains(err.Error(), \"Unknown data source\") { /* run packer init */ }\n}","preventionTips":["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."],"tags":["plugin-registry","datasource","config"],"backgroundTag":"unknown-component-type","analyzedSha":"eb36e3c3e48a036f3e8cc94087636ee72e1303c9","analyzedAt":"2026-09-05T13:20:43.127Z","contentChangedAt":"2026-09-05T13:20:43.127Z","schemaVersion":2},"datasetVersion":"2026-09-12T17:17:11.597Z"}