{"record":{"id":"fa39c9a60f1f2387","repo":"wagoodman/dive","slug":"build-option-not-supported-for-docker-archive-reso","errorCode":null,"errorMessage":"build option not supported for docker archive resolver","messagePattern":"build option not supported for docker archive resolver","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"dive/image/docker/archive_resolver.go","lineNumber":37,"sourceCode":"\treturn \"docker-archive\"\n}\n\nfunc (r *archiveResolver) Fetch(ctx context.Context, path string) (*image.Image, error) {\n\treader, err := os.Open(path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdefer reader.Close()\n\n\timg, err := NewImageArchive(reader)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn img.ToImage(path)\n}\n\nfunc (r *archiveResolver) Build(ctx context.Context, args []string) (*image.Image, error) {\n\treturn nil, fmt.Errorf(\"build option not supported for docker archive resolver\")\n}\n\nfunc (r *archiveResolver) Extract(ctx context.Context, id string, l string, p string) error {\n\treturn fmt.Errorf(\"not implemented\")\n}\n","sourceCodeStart":19,"sourceCodeEnd":43,"githubUrl":"https://github.com/wagoodman/dive/blob/d6c691947f8fda635c952a17ee3b7555379d58f0/dive/image/docker/archive_resolver.go#L19-L43","documentation":"Returned by archiveResolver.Build (dive/image/docker/archive_resolver.go:37). A docker-archive resolver reads an already-saved tarball; it has no builder, so any Build() call fails with this fixed message. It implements the image.Resolver interface but only supports Fetch of a pre-existing archive.","triggerScenarios":"Combining an archive source with build semantics: 'dive --source docker-archive image.tar --build ...' or, as a library user, calling Build() on the resolver returned by NewResolverFromArchive() with any build arguments.","commonSituations":"CI pipelines that use one generic dive invocation with --build for engine sources and forget to drop the flag for archive analysis; Makefile targets that share BUILD_ARGS across docker and docker-archive invocations.","solutions":["Remove --build (and any -b/--build-arg style flags) when analyzing a saved tarball: dive docker-archive://image.tar or dive --source docker-archive image.tar","If you meant to build first, build with the engine resolver or plain 'docker build', then 'docker save' and analyze the tar","In library code, switch on the resolver type before calling Build, or check the configured source is engine-backed"],"exampleFix":"# before\ndive --source docker-archive app.tar --build .\n\n# after\ndive --source docker-archive app.tar","handlingStrategy":"validation","validationCode":"// check the configured source before attempting a build\nif src == dive.SourceDockerArchive {\n    return fmt.Errorf(\"cannot --build with docker-archive source; pre-build and docker save instead\")\n}\nimg, err := resolver.Build(ctx, buildArgs)","typeGuard":null,"tryCatchPattern":"img, err := resolver.Build(ctx, args)\nif err != nil && strings.Contains(err.Error(), \"build option not supported\") {\n    // fall back: build outside dive, analyze the produced image\n    img, err = prebuiltImage(ctx) // your build-then-analyze path\n}\nif err != nil {\n    return err\n}","preventionTips":["Keep dive invocations per-source: no --build on archive runs","Build images with docker/podman directly, then analyze with dive docker://<image>","Centralize the dive command per CI job instead of one generic template"],"tags":["docker-archive","build","unsupported-operation","configuration"],"backgroundTag":null,"analyzedSha":"d6c691947f8fda635c952a17ee3b7555379d58f0","analyzedAt":"2026-08-15T09:42:35.293Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}