{"record":{"id":"a69af03b3a396eb1","repo":"wagoodman/dive","slug":"cannot-determine-image-provider-for-build-w","errorCode":null,"errorMessage":"cannot determine image provider for build: %w","messagePattern":"cannot determine image provider for build: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/dive/cli/internal/command/build.go","lineNumber":33,"sourceCode":"\t// reserved for future use of build-only flags\n}\n\nfunc Build(app clio.Application) *cobra.Command {\n\topts := &buildOptions{\n\t\tApplication: options.DefaultApplication(),\n\t}\n\treturn app.SetupCommand(&cobra.Command{\n\t\tUse:                \"build [any valid `docker build` arguments]\",\n\t\tShort:              \"Builds and analyzes a docker image from a Dockerfile (this is a thin wrapper for the `docker build` command).\",\n\t\tDisableFlagParsing: true,\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\tif err := setUI(app, opts.Application); err != nil {\n\t\t\t\treturn fmt.Errorf(\"failed to set UI: %w\", err)\n\t\t\t}\n\n\t\t\tresolver, err := dive.GetImageResolver(opts.Analysis.Source)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"cannot determine image provider for build: %w\", err)\n\t\t\t}\n\n\t\t\tctx := cmd.Context()\n\n\t\t\timg, err := adapter.ImageResolver(resolver).Build(ctx, args)\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"cannot build image: %w\", err)\n\t\t\t}\n\n\t\t\treturn run(cmd.Context(), opts.Application, img, resolver)\n\t\t},\n\t}, opts)\n}\n","sourceCodeStart":15,"sourceCodeEnd":47,"githubUrl":"https://github.com/wagoodman/dive/blob/d6c691947f8fda635c952a17ee3b7555379d58f0/cmd/dive/cli/internal/command/build.go#L15-L47","documentation":"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.","triggerScenarios":"Passing --source with an unsupported/misspelled value, or selecting a provider whose engine is unavailable; GetImageResolver then returns an error before any build runs.","commonSituations":"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.","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"],"exampleFix":"# before\ndive build --source dockr .\n\n# after\ndive build --source docker .","handlingStrategy":"validation","validationCode":"# pin the source to an engine that exists on this host\ncommand -v docker >/dev/null && SRC=docker || SRC=podman\ndive build --source \"$SRC\" .","typeGuard":null,"tryCatchPattern":"resolver, err := dive.GetImageResolver(opts.Analysis.Source)\nif err != nil {\n    // invalid/missing provider: fall back to probing installed engines\n    if command -v docker; then opts.Analysis.Source = \"docker\"; resolver, err = dive.GetImageResolver(\"docker\") }\n    if err != nil { return fmt.Errorf(\"cannot determine image provider for build: %w\", err) }\n}","preventionTips":["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"],"tags":["source","provider","docker","podman","configuration"],"backgroundTag":null,"analyzedSha":"d6c691947f8fda635c952a17ee3b7555379d58f0","analyzedAt":"2026-08-15T09:42:35.293Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}