hashicorp/packer · error

The protocol of this plugin (protocol version 4 and lower) w

Error message

The protocol of this plugin (protocol version 4 and lower) was deprecated, please use a newer version of this plugin.Or use an older version of Packer (pre 1.7) with this plugin.

What it means

When the plugin client starts a plugin binary, the plugin prints a pipe-delimited handshake line. If the line has only 3 fields, the plugin speaks protocol version 4 or lower, which Packer 1.7+ no longer supports, so Start refuses to connect and returns this deprecation error.

Source

Thrown at packer/plugin_client.go:331

	// Some channels for the next step
	timeout := time.After(c.config.StartTimeout)

	// Start looking for the address
	log.Printf("Waiting for RPC address for: %s", cmd.Path)
	select {
	case <-timeout:
		err = errors.New("timeout while waiting for plugin to start")
	case <-exitCh:
		err = errors.New("plugin exited before we could connect")
	case lineBytes := <-linesCh:
		// Trim the line and split by "|" in order to get the parts of
		// the output.
		line := strings.TrimSpace(string(lineBytes))
		parts := strings.SplitN(line, "|", 4)
		if len(parts) == 3 {
			// In protocol version 4 and before, the protocol only had a Major
			// version
			err = fmt.Errorf("The protocol of this plugin (protocol version 4 " +
				"and lower) was deprecated, please use a newer version of this plugin." +
				"Or use an older version of Packer (pre 1.7) with this plugin.")
			return nil, err
		}
		if len(parts) < 4 {
			err = fmt.Errorf("Unrecognized remote plugin message: %s", line)
			return nil, err
		}
		pluginMajorAPIVersion, pluginMinorAPIVersion, network, netAddr := parts[0], parts[1], parts[2], parts[3]

		// Test the API versions
		if pluginMajorAPIVersion != pluginsdk.APIVersionMajor {
			err = fmt.Errorf("Incompatible API MAJOR version with plugin. "+
				"plugin MINOR API version: %s, Ours: %s", pluginMajorAPIVersion, pluginsdk.APIVersionMajor)
			return nil, err
		}
		if pluginMinorAPIVersion > pluginsdk.APIVersionMinor {
			err = fmt.Errorf("Incompatible API MINOR version with plugin. "+

View on GitHub (pinned to eb36e3c3e4)

Solutions

  1. Upgrade the plugin to a version built against a current packer-plugin-sdk (protocol 5+).
  2. If the plugin cannot be upgraded, run Packer pre-1.7 with it.
  3. Replace the plugin with an equivalent maintained one.

Example fix

// before
$ packer build old-template.json  # uses my-legacy-plugin v0.1.0
// error: protocol version 4 and lower was deprecated...
// after
$ packer plugins install github.com/example/my-legacy-plugin  # fetch latest protocol-compatible release
Defensive patterns

Strategy: validation

Validate before calling

out, err := exec.Command(pluginPath, "packer-plugin").Output()
if err != nil || len(strings.Split(strings.TrimSpace(string(out)), "|")) < 4 {
  // plugin speaks pre-1.7 protocol; upgrade plugin or use Packer <1.7
}

Try / catch

if _, err := client.Start(); err != nil {
  if strings.Contains(err.Error(), "deprecated") {
    // upgrade plugin or pin older Packer
  }
}

Prevention

When it happens

Trigger: Client.Start() on packer/plugin_client.go reads the plugin's handshake line from stdout; strings.SplitN(line, "|", 4) yields exactly 3 parts, i.e. the binary implements the old pre-1.7 protocol.

Common situations: Running a very old community plugin (built before ~2021) with modern Packer; a vendored/internal plugin never upgraded to the go-plugin protocol v5 / SDK API version format; manually built old plugin code with an old packer-plugin-sdk.

Related errors


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