hashicorp/packer · error

unknown builder type(s): %v

Error message

unknown builder type(s): %v

What it means

Warning-level error emitted by `packer hcl2 upgrade`: the template references a builder type that is neither installed as a plugin nor recognized as a known plugin component, so its configuration cannot be fully translated; the builder is listed and left for manual migration.

Source

Thrown at command/hcl2_upgrade.go:1273

		body := sourcesContent.Body()
		body.AppendNewline()
		if !p.BuilderPlugins.Has(builderCfg.Type) && knownPluginComponent(builderCfg.Type) == unknownPluginName {
			unknownBuilders = append(unknownBuilders, builderCfg.Type)
		}
		if builderCfg.Name == "" || builderCfg.Name == builderCfg.Type {
			builderCfg.Name = fmt.Sprintf("autogenerated_%d", i+1)
		}
		builderCfg.Name = strings.ReplaceAll(strings.TrimSpace(builderCfg.Name), " ", "_")

		sourceBody := body.AppendNewBlock("source", []string{builderCfg.Type, builderCfg.Name}).Body()

		jsonBodyToHCL2Body(sourceBody, builderCfg.Config)

		p.out = append(p.out, transposeTemplatingCalls(sourcesContent.Bytes())...)
	}
	// TODO update to output to stderr as opposed to having the command exit 1
	if len(unknownBuilders) > 0 {
		return fmt.Errorf("unknown builder type(s): %v\n", unknownBuilders)
	}

	return nil
}

func (p *SourceParser) Write(out *bytes.Buffer) {
	if len(p.out) > 0 {
		if p.WithAnnotations {
			out.Write([]byte(sourcesHeader))
		}
		out.Write(p.out)
	}
}

type BuildParser struct {
	Builders        []*template.Builder
	WithAnnotations bool

View on GitHub (pinned to eb36e3c3e4)

Solutions

  1. Install the plugin for the listed builder type via `packer init` or `packer plugins install` and re-run the upgrade
  2. Manually migrate the unknown builder block to an equivalent source block in HCL2
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at command/hcl2_upgrade.go:1273 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of hashicorp/packer@eb36e3c3e4 (2026-09-05). Data as JSON: /api/errors/468bcfd42cdf6dea. Report an issue: GitHub.