Humanizr/Humanizer · error · InvalidOperationException
Could not find the Humanizer repository root from '{start}'.
Error message
Could not find the Humanizer repository root from '{start}'. What it means
Thrown by FindRepositoryRoot when the generator cannot locate Humanizer.slnx by walking up the directory tree from the given start path. The generator needs the repository root to resolve the path to the output file (src/Humanizer/Inflections/InflectionUnicodeData.cs).
Source
Thrown at tools/Humanizer.UnicodeDataGenerator/Program.cs:139
}
else
{
Console.WriteLine("Regenerated Unicode 16 inflection data from all five hash-pinned inputs.");
}
return 0;
static string FindRepositoryRoot(string start)
{
for (var current = new DirectoryInfo(start); current is not null; current = current.Parent)
{
if (File.Exists(Path.Combine(current.FullName, "Humanizer.slnx")))
{
return current.FullName;
}
}
throw new InvalidOperationException(
$"Could not find the Humanizer repository root from '{start}'.");
}
static string NormalizeLineEndings(string value) =>
value.Replace("\r\n", "\n", StringComparison.Ordinal)
.Replace('\r', '\n');
static bool CheckOrWrite(string path, string expected, bool check)
{
var current = NormalizeLineEndings(File.ReadAllText(path));
if (current == expected)
{
return false;
}
if (!check)
{
File.WriteAllText(View on GitHub (pinned to ffc2b77c0f)
Solutions
- Run the generator from within the Humanizer repository so it can find Humanizer.slnx.
- Verify Humanizer.slnx exists at the repository root.
- If the repository was restructured, update FindRepositoryRoot to look for the new marker file.
Example fix
# before: running from outside the repo tree cd /tmp && dotnet run --project /path/to/Humanizer/tools/Humanizer.UnicodeDataGenerator -- /tmp/ucd # after: run from inside the repo cd /path/to/Humanizer && dotnet run --project tools/Humanizer.UnicodeDataGenerator -- ./ucd
Defensive patterns
Strategy: validation
Validate before calling
static string? TryFindRepoRoot(string start)
{
for (var dir = new DirectoryInfo(start); dir is not null; dir = dir.Parent)
{
if (File.Exists(Path.Combine(dir.FullName, "Humanizer.slnx")))
return dir.FullName;
}
return null;
} Prevention
- Always run the generator from within the Humanizer repository.
- Verify Humanizer.slnx exists at the root before running.
- Use a wrapper script that sets the working directory to the repo root.
When it happens
Trigger: Running the generator from a directory that is not inside the Humanizer repository tree (e.g. from /tmp or a sibling directory). Also when the slnx file was renamed or removed.
Common situations: Contributor clones only a subfolder. Running the generator in a CI environment with an unexpected working directory. The repository was restructured and Humanizer.slnx was moved.
Related errors
- Missing Unicode 16 input '{input.Key}'.
- Unicode 16 input '{input.Key}' has SHA-256 {actual}; expecte
- Generated Unicode 16 inflection data is stale. Run the gener
AI-assisted analysis of Humanizr/Humanizer@ffc2b77c0f (2026-08-13).
Data as JSON: /api/errors/0857e968c2e0d25f.
Report an issue: GitHub.