ERROR: failed to build: failed to solve: base name ($BASE) should not be blank means FROM $BASE was read while the ARG BASE had no value: no default in the Dockerfile and no --build-arg BASE=... on the command line. Give it a default, or pass the value when you build.

ARG BASE=alpine:latest above FROM fixed it in the test, and so did --build-arg BASE=alpine:latest with the original file.

The error

...
#1 [internal] load build definition from Dockerfile
#1 transferring dockerfile:
#1 transferring dockerfile: 81B done
#1 WARN: InvalidDefaultArgInFrom: Default value for ARG $BASE results in empty or invalid base image name (line 2)
#1 DONE 0.1s

 1 warning found (use docker --debug to expand):
 - InvalidDefaultArgInFrom: Default value for ARG $BASE results in empty or invalid base image name (line 2)
Dockerfile:2
--------------------
   1 |     ARG BASE
   2 | >>> FROM $BASE
   3 |     WORKDIR /app
   4 |     CMD ["sh"]
--------------------
ERROR: failed to build: failed to solve: base name ($BASE) should not be blank

The terminal colour codes around "1 warning found" were removed from the capture above.

Why it happens

An ARG above the first FROM lets one Dockerfile build on different base images. ARG BASE declares the name but gives it no value, so unless the build command supplies one, $BASE expands to an empty string and FROM has no image to start from. The build stopped while reading the Dockerfile; no image was pulled.

The output carries two messages. The first is a build check warning, InvalidDefaultArgInFrom, whose text is about the default value in the file. The second is the error that ends the build. The warning was still printed when the value was passed with --build-arg and the build succeeded; once the file had a default, it was gone.

The fix

Pass the value on the command line:

docker build --progress=plain --build-arg BASE=alpine:latest -t fix9-bld-c6 .

That build ended with exit code: 0, with the warning still printed. Or give the argument a default:

ARG BASE=alpine:latest
FROM $BASE
WORKDIR /app
CMD ["sh"]

docker build --progress=plain -t fix9-bld-c6 . on this file ended with exit code: 0 and no warning. A default keeps the plain docker build . working, and --build-arg still replaced it: with --build-arg BASE=ubuntu:24.04 on this file the build's FROM step read docker.io/library/ubuntu:24.04 and ended with exit code: 0.

How it was reproduced

A four-line Dockerfile with ARG BASE and FROM $BASE, built with docker build --progress=plain -t fix9-bld-c6 . on Docker Desktop for Windows, client and engine 29.9.3, buildx v0.38.1; the base used for the fix was the cached alpine:latest (image id 294b683cb724). The image name is the test's own.

Frequently asked

What does 'base name ($BASE) should not be blank' mean?
FROM uses an ARG that has no value: the Dockerfile gives it no default and the build command passed no --build-arg for it. FROM is left with no image name.
How do I pass the base image to docker build?
Use --build-arg BASE=alpine:latest (or your image) with an ARG BASE line above FROM. In the test that build succeeded.
How do I get rid of the InvalidDefaultArgInFrom warning?
Give the ARG a default value in the Dockerfile, such as ARG BASE=alpine:latest. In the test the warning stayed with --build-arg alone and was gone with a default.

More decoded errors in the Fixes category. An ARG that has a value above FROM but is empty inside the stage is a different warning, covered in UndefinedVar: Usage of undefined variable.