wagoodman/dive · error
cannot determine image provider for build: %w
Error message
cannot determine image provider for build: %w
What it means
Returned by `dive build` when dive.GetImageResolver(opts.Analysis.Source) cannot map the configured source to an image provider. The source option (--source) selects which engine supplies images; resolution fails when the value is not one of the supported providers (docker, podman) or the provider cannot be used in this environment.
Source
Thrown at cmd/dive/cli/internal/command/build.go:33
// reserved for future use of build-only flags
}
func Build(app clio.Application) *cobra.Command {
opts := &buildOptions{
Application: options.DefaultApplication(),
}
return app.SetupCommand(&cobra.Command{
Use: "build [any valid `docker build` arguments]",
Short: "Builds and analyzes a docker image from a Dockerfile (this is a thin wrapper for the `docker build` command).",
DisableFlagParsing: true,
RunE: func(cmd *cobra.Command, args []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 for build: %w", err)
}
ctx := cmd.Context()
img, err := adapter.ImageResolver(resolver).Build(ctx, args)
if err != nil {
return fmt.Errorf("cannot build image: %w", err)
}
return run(cmd.Context(), opts.Application, img, resolver)
},
}, opts)
}
View on GitHub (pinned to d6c691947f)
Solutions
- Check the wrapped message for the accepted source values
- Use --source docker or --source podman explicitly
- Verify the chosen engine is installed and its socket/CLI is reachable (docker version / podman version)
- Remove stale --source flags copied from other environments
Example fix
# before dive build --source dockr . # after dive build --source docker .
Defensive patterns
Strategy: validation
Validate before calling
# pin the source to an engine that exists on this host command -v docker >/dev/null && SRC=docker || SRC=podman dive build --source "$SRC" .
Try / catch
resolver, err := dive.GetImageResolver(opts.Analysis.Source)
if err != nil {
// invalid/missing provider: fall back to probing installed engines
if command -v docker; then opts.Analysis.Source = "docker"; resolver, err = dive.GetImageResolver("docker") }
if err != nil { return fmt.Errorf("cannot determine image provider for build: %w", err) }
} Prevention
- Always pass --source explicitly in scripts
- Verify the engine binary is installed before invoking dive build
- Keep the source key in dive config in sync with what the host runs
When it happens
Trigger: Passing --source with an unsupported/misspelled value, or selecting a provider whose engine is unavailable; GetImageResolver then returns an error before any build runs.
Common situations: Typo in --source (e.g. --source dockr); new users assuming dive build works without any container engine installed; configs written for podman used on docker-only hosts.
Related errors
- cannot determine image provider to fetch from: %w
- no results returned
- cannot build image: %w
- cannot load image: %w
- cannot analyze image: %w
AI-assisted analysis of wagoodman/dive@d6c691947f (2026-08-15).
Data as JSON: /api/errors/a69af03b3a396eb1.
Report an issue: GitHub.