wagoodman/dive · error

cannot determine image provider to fetch from: %w

Error message

cannot determine image provider to fetch from: %w

What it means

Returned by `dive <image>` when dive.GetImageResolver(opts.Analysis.Source) cannot map the configured --source to an image provider. The source selects which engine to fetch the image from; resolution fails for unknown/unsupported source values or when the provider is unusable on the host, before any fetch is attempted.

Source

Thrown at cmd/dive/cli/internal/command/root.go:48

		Use:   "dive [IMAGE]",
		Short: "Docker Image Visualizer & Explorer",
		Long: `This tool provides a way to discover and explore the contents of a docker image. Additionally the tool estimates
the amount of wasted space and identifies the offending files from the image.`,
		Args: func(cmd *cobra.Command, args []string) error {
			if len(args) != 1 {
				return fmt.Errorf("exactly one argument is required")
			}
			opts.Analysis.Image = args[0]
			return nil
		},
		RunE: func(cmd *cobra.Command, _ []string) error {
			if err := setUI(app, opts.Application); err != nil {
				return fmt.Errorf("failed to set UI: %w", err)
			}

			resolver, err := dive.GetImageResolver(opts.Analysis.Source)
			if err != nil {
				return fmt.Errorf("cannot determine image provider to fetch from: %w", err)
			}

			ctx := cmd.Context()

			img, err := adapter.ImageResolver(resolver).Fetch(ctx, opts.Analysis.Image)
			if err != nil {
				return fmt.Errorf("cannot load image: %w", err)
			}

			return run(ctx, opts.Application, img, resolver)
		},
	}, opts)
}

func setUI(app clio.Application, opts options.Application) error {
	type Stater interface {
		State() *clio.State
	}

View on GitHub (pinned to d6c691947f)

Solutions

  1. Check the wrapped message for the list of valid sources
  2. Set --source explicitly to docker or podman as installed on the host
  3. Confirm the engine works at all: docker version / podman version
  4. Remove or update the source key in your dive config file

Example fix

# before
dive alpine --source containerd   # unsupported

# after
dive alpine --source docker
Defensive patterns

Strategy: validation

Validate before calling

# pin the source to a locally available engine
command -v docker >/dev/null && SRC=docker || SRC=podman
dive myimage:latest --source "$SRC"

Try / catch

resolver, err := dive.GetImageResolver(opts.Analysis.Source)
if err != nil {
    // unknown/unavailable provider: probe engines and retry with an explicit source
    return fmt.Errorf("cannot determine image provider to fetch from: %w", err)
}

Prevention

When it happens

Trigger: dive image --source <bad-value>, or a default source that is not available in the current environment; GetImageResolver errors immediately and the fetch never runs.

Common situations: Misspelled --source; assuming dive defaults to podman on a docker-only host (or vice versa); stale config files carrying a source value from an older dive version with a different provider list.

Related errors


AI-assisted analysis of wagoodman/dive@d6c691947f (2026-08-15). Data as JSON: /api/errors/f478b7340d96ccf7. Report an issue: GitHub.