dotnet/runtime · error · FileNotFoundError

{} not present at {}

Error message

{} not present at {}

What it means

Raised by fuzzer_setup.py after running 'dotnet publish' on the Antigen or Fuzzlyn tool project. It checks whether the expected output DLL (Antigen.dll or Fuzzlyn.dll) exists in the publish directory. If the publish step failed silently or produced output with a different name, this error fires.

Source

Thrown at src/coreclr/scripts/fuzzer_setup.py:149

                run_command(
                    ["git", "clone", "--quiet", "--no-checkout", "--filter=blob:none",
                     "--depth", "1", "--sparse", repo_url, tool_code_directory])
                with ChangeDir(tool_code_directory):
                    run_command(["git", "sparse-checkout", "set", "--cone", sparse_path])
                    run_command(["git", "checkout"])

            publish_dir = path.join(tool_code_directory, "publish")

            # build the tool
            with ChangeDir(tool_code_directory):
                dotnet_cmd = os.path.join(source_directory, "dotnet.cmd")
                if not is_windows:
                    dotnet_cmd = os.path.join(source_directory, "dotnet.sh")
                run_command([dotnet_cmd, "publish", proj_path.replace("/", os.sep), "-c", "Release", "--self-contained", "-r", run_configuration, "-o", publish_dir], _exit_on_fail=True)

            dll_name = coreclr_args.tool_name + ".dll"
            if not os.path.exists(path.join(publish_dir, dll_name)):
                raise FileNotFoundError("{} not present at {}".format(dll_name, publish_dir))

            # copy tool
            print('Copying {} -> {}'.format(publish_dir, dst_directory))
            copy_directory(publish_dir, dst_directory, verbose_output=True, match_func=acceptable_copy)
    except PermissionError as pe:
        print("Skipping file. Got error: %s", pe)

    # create a dummy file in the work_item directories, otherwise Helix complains
    workitem_directory = path.join(source_directory, "workitem")
    os.mkdir(workitem_directory)
    foo_txt = os.path.join(workitem_directory, "foo.txt")
    with open(foo_txt, "w") as foo_txt_file:
        foo_txt_file.write("hello world!")

    # Set variables
    print('Setting pipeline variables:')
    set_pipeline_variable("CorrelationPayloadDirectory", correlation_payload_directory)
    set_pipeline_variable("WorkItemDirectory", workitem_directory)

View on GitHub (pinned to 60108ba66e)

Solutions

  1. Manually run 'dotnet publish <proj_path> -c Release --self-contained -r <RID> -o <publish_dir>' and inspect for errors.
  2. Check that the dotnet SDK version in dotnet.sh/dotnet.cmd is compatible with the tool project's target framework.
  3. Verify the cloned repository is at a compatible commit and the .csproj AssemblyName matches the expected tool_name.
  4. Ensure the run configuration string (os_name-arch_name, e.g., 'linux-x64') is a valid RID.
  5. Inspect the publish directory contents to see what was actually produced.

Example fix

# before
dll_name = coreclr_args.tool_name + ".dll"
if not os.path.exists(path.join(publish_dir, dll_name)):
    raise FileNotFoundError("{} not present at {}".format(dll_name, publish_dir))

# after - list publish dir contents in error to aid debugging
dll_name = coreclr_args.tool_name + ".dll"
if not os.path.exists(path.join(publish_dir, dll_name)):
    published = os.listdir(publish_dir) if os.path.isdir(publish_dir) else []
    raise FileNotFoundError(
        "{} not present at {}. Publish dir contents: {}".format(
            dll_name, publish_dir, published))
Defensive patterns

Strategy: validation

Validate before calling

import os

def validate_publish_output(publish_dir: str, tool_name: str) -> bool:
    """Check that dotnet publish produced the expected DLL."""
    dll_name = tool_name + ".dll"
    dll_path = os.path.join(publish_dir, dll_name)
    if not os.path.exists(dll_path):
        # List what was actually produced for diagnosis
        if os.path.isdir(publish_dir):
            contents = os.listdir(publish_dir)
            dll_files = [f for f in contents if f.endswith('.dll')]
            print(f"Expected {dll_name} but found DLLs: {dll_files}")
        return False
    return True

Type guard

null

Try / catch

# run_command with _exit_on_fail=True should prevent reaching this check
# on publish failure, but as a safety net:
try:
    if not validate_publish_output(publish_dir, coreclr_args.tool_name):
        raise FileNotFoundError(
            f"{coreclr_args.tool_name}.dll not in {publish_dir}. "
            f"Check dotnet publish output for errors.")
except FileNotFoundError:
    raise

Prevention

When it happens

Trigger: Triggered at line 148-149 when os.path.exists(path.join(publish_dir, dll_name)) returns False after the 'dotnet publish' command completed. The dll_name is constructed as coreclr_args.tool_name + '.dll'. This happens when dotnet publish fails without raising (run_command uses _exit_on_fail=True so it should exit, but a race or partial publish could leave the DLL missing), or when the project's AssemblyName differs from the project/tool name.

Common situations: The dotnet SDK version is incompatible with the tool's project file, causing publish to produce incomplete output. The tool repository (jitutils for Antigen, Fuzzlyn repo) was cloned at a commit where the project structure changed. The run configuration (e.g., 'linux-x64') doesn't match any RID the project targets. Network issues during restore prevent assemblies from being built.

Related errors


AI-assisted analysis of dotnet/runtime@60108ba66e (2026-08-10). Data as JSON: /api/errors/43e76149596e0115. Report an issue: GitHub.