quarkusio/quarkus · error · BuildException

Staging directory does not exist. Rebuild the app

Error message

Staging directory does not exist.  Rebuild the app

What it means

Raised by AzureFunctionsRunCommand.run when the local staging directory that should contain the built function app artifacts is missing. The run command expects 'mvn package' (or the Gradle equivalent) to have produced the staging directory with the function app, host.json and dependencies before starting the local Functions host; its absence means the app was never built or was cleaned after building.

Source

Thrown at extensions/azure-functions/deployment/src/main/java/io/quarkus/azure/functions/deployment/AzureFunctionsRunCommand.java:45

public class AzureFunctionsRunCommand {
    private static final Logger log = Logger.getLogger(AzureFunctionsRunCommand.class);
    protected static final String FUNC_CMD = "func -v";
    protected static final String FUNC_HOST_START_CMD = "func host start -p %s";
    protected static final String RUNTIME_NOT_FOUND = "Azure Functions Core Tools not found. " +
            "Please go to https://aka.ms/azfunc-install to install Azure Functions Core Tools first.";
    private static final String FUNC_HOST_START_WITH_DEBUG_CMD = "func host start -p %s --language-worker -- " +
            "\"-agentlib:jdwp=%s\"";
    private static final String STARTED_EXPRESSION = "Host lock lease acquired";

    @BuildStep
    public RunCommandActionBuildItem run(List<AzureFunctionBuildItem> functions, OutputTargetBuildItem target,
            AzureFunctionsAppNameBuildItem appName,
            AzureFunctionsConfig config) throws Exception {
        Path stagingDir = getDeploymentStagingDirectoryPath(target, appName.getAppName());
        File file = stagingDir.toFile();
        if (!file.exists() || !file.isDirectory()) {
            throw new BuildException("Staging directory does not exist.  Rebuild the app", Collections.emptyList());
        }

        final CommandHandler commandHandler = new CommandHandlerImpl();

        checkRuntimeExistence(commandHandler);

        String cmd = getStartFunctionHostCommand(config);
        List<String> args = new LinkedList<>();
        Arrays.stream(cmd.split(" ")).forEach(s -> args.add(s));
        RunCommandActionBuildItem launcher = new RunCommandActionBuildItem(AZURE_FUNCTIONS, args, stagingDir,
                STARTED_EXPRESSION, null,
                true);
        return launcher;
    }

    protected Path getDeploymentStagingDirectoryPath(OutputTargetBuildItem target, String appName) {
        return target.getOutputDirectory().resolve(AZURE_FUNCTIONS).resolve(appName);
    }

View on GitHub (pinned to e1c734241f)

Solutions

  1. Run the package phase (./mvnw clean package or ./gradlew build) to produce the staging directory
  2. Verify the azure-functions configuration stagingDirectoryPath points at the directory the build actually produced
  3. Clean and rebuild if the staging directory exists but is incomplete
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at extensions/azure-functions/deployment/src/main/java/io/quarkus/azure/functions/deployment/AzureFunctionsRunCommand.java:45 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05). Data as JSON: /api/errors/8fe46e6eb6b2fdfd. Report an issue: GitHub.