pulumi/pulumi · error

could not list list: %w

Error message

could not list list: %w

What it means

LocalWorkspace.ListPlugins runs `pulumi plugin ls --json`. If the CLI exits non-zero, the error is wrapped in an AutomationError carrying stdout, stderr and exit code. (The wording 'could not list list' is a typo for 'could not list plugins'.)

Source

Thrown at sdk/go/auto/local_workspace.go:775

		return newAutoError(fmt.Errorf("failed to install plugin: %w", err), stdout, stderr, errCode)
	}
	return nil
}

// RemovePlugin deletes the plugin matching the specified name and verision.
func (l *LocalWorkspace) RemovePlugin(ctx context.Context, name string, version string) error {
	stdout, stderr, errCode, err := l.runPulumiCmdSync(ctx, "plugin", "rm", "resource", name, version, "--yes")
	if err != nil {
		return newAutoError(fmt.Errorf("failed to remove plugin: %w", err), stdout, stderr, errCode)
	}
	return nil
}

// ListPlugins lists all installed plugins.
func (l *LocalWorkspace) ListPlugins(ctx context.Context) ([]workspace.PluginInfo, error) {
	stdout, stderr, errCode, err := l.runPulumiCmdSync(ctx, "plugin", "ls", "--json")
	if err != nil {
		return nil, newAutoError(fmt.Errorf("could not list list: %w", err), stdout, stderr, errCode)
	}
	var plugins []workspace.PluginInfo
	err = json.Unmarshal([]byte(stdout), &plugins)
	if err != nil {
		return nil, fmt.Errorf("unable to unmarshal plugin response: %w", err)
	}
	return plugins, nil
}

// Program returns the program `pulumi.RunFunc` to be used for Preview/Update if any.
// If none is specified, the stack will refer to ProjectSettings for this information.
func (l *LocalWorkspace) Program() pulumi.RunFunc {
	return l.program
}

// SetProgram sets the program associated with the Workspace to the specified `pulumi.RunFunc`.
func (l *LocalWorkspace) SetProgram(fn pulumi.RunFunc) {
	l.program = fn

View on GitHub (pinned to 793f7b2e16)

Solutions

  1. Read err.StandardError()/StandardOutput() from the AutomationError
  2. Verify `pulumi plugin ls --json` works in a shell and reinstall the CLI if broken
  3. Check PulumiWorkspace/EnvVars to confirm the right pulumi binary and environment are used
  4. Delete or repair the plugin cache directory if it is corrupt
Defensive patterns

Strategy: try-catch

Validate before calling

if _, err := exec.LookPath("pulumi"); err != nil { return fmt.Errorf("pulumi CLI not on PATH") }

Type guard

func isAutomationError(err error) (*auto.AutomationError, bool) {
  var ae *auto.AutomationError
  return ae, errors.As(err, &ae)
}

Try / catch

plugins, err := ws.ListPlugins(ctx)
if err != nil {
  if ae, ok := isAutomationError(err); ok { log.Printf("plugin ls failed: %s", ae.Stderr()) }
  return nil, err
}

Prevention

When it happens

Trigger: Calling ListPlugins when the pulumi binary fails to run: corrupt CLI install, missing CLI on PATH, or plugin cache in a broken state causing the CLI itself to error.

Common situations: Pulumi CLI not installed or wrong PATH; corrupted ~/.pulumi/plugins directory; extremely old CLI without --json support failing on the flag.

Related errors


AI-assisted analysis of pulumi/pulumi@793f7b2e16 (2026-08-31). Data as JSON: /api/errors/6dbde724ad5fb291. Report an issue: GitHub.