dotnet/runtime · error

Fail: %s

Error message

Fail: %s

What it means

Printed by self_test() in the catch(const char_t msg[]) handler when a THROW_IF_FALSE / THROW_IF_TRUE macro throws. The message is the stringified C++ statement that failed (e.g. 'config.wait_to_debug' or 'parse_args(3, args, config)'). self_test is invoked when corerun is launched with '-st'.

Source

Thrown at src/coreclr/hosts/corerun/corerun.cpp:985

            pal::ensure_trailing_delimiter(path);
            THROW_IF_FALSE(path.back() == pal::dir_delim || path.length() == 1);
            path = W("/");
            pal::ensure_trailing_delimiter(path);
            THROW_IF_FALSE(path.back() == pal::dir_delim || path.length() == 1);
        }
        {
            THROW_IF_FALSE(!pal::string_ends_with(W(""), W(".cd")));
            THROW_IF_FALSE(pal::string_ends_with(W("ab.cd"), W(".cd")));
            THROW_IF_FALSE(!pal::string_ends_with(W("ab.cd"), W(".cde")));
            THROW_IF_FALSE(!pal::string_ends_with(W("ab.cd"), W("ab.cde")));
        }
        {
            dotenv::self_test();
        }
    }
    catch (const char_t msg[])
    {
        pal::fprintf(stderr, W("Fail: %s\n"), msg);
        return EXIT_FAILURE;
    }

    pal::fprintf(stdout, W("Self-test passed.\n"));
    return EXIT_SUCCESS;
}

View on GitHub (pinned to 290d5ab72c)

Solutions

  1. Read the 'Fail: <statement>' line to see exactly which assertion tripped.
  2. Revert / fix the change to parse_args or the named pal helper so the stringified condition holds again.
  3. Run the smaller unit under a debugger adding more THROW_IF_FALSE probes to localize the regression.
  4. Re-run 'corerun -st' to confirm 'Self-test passed.' prints.

Example fix

// before: parse_args signature changed but self_test still calls old form
THROW_IF_FALSE(parse_args(3, args, config));
// after: update self_test to match new signature
THROW_IF_FALSE(parse_args(3, args, /*new arg*/nullptr, config));
Defensive patterns

Strategy: validation

Validate before calling

# in CI, run self-test and fail the build if it doesn't print 'Self-test passed.'
corerun -st | tee selftest.log
grep -q 'Self-test passed\.' selftest.log || { echo 'corerun self-test failed'; exit 1; }

Prevention

When it happens

Trigger: corerun -st runs an internal regression over parse_args() and pal helpers (ensure_trailing_delimiter, string_ends_with, dotenv::self_test). If any assertion fails it throws the stringified condition, caught here. Returns EXIT_FAILURE.

Common situations: A developer modified parse_args(), the pal string helpers, or dotenv and broke an invariant; running -st against a new platform where pal behavior differs; regression during a CoreCLR build.

Related errors


AI-assisted analysis of dotnet/runtime@290d5ab72c (2026-08-06). Data as JSON: /api/errors/566ae40a6bfbead2. Report an issue: GitHub.