LykosAI/StabilityMatrix · warning · DocumentationNotAvailableException

Documentation folder is empty or not available yet.

Error message

Documentation folder is empty or not available yet.

What it means

After successfully listing the docs repo paths, FetchDocsPathsAsync filters them with IsDocPage. If no paths survive the filter, the documentation folder is considered empty or not yet available and DocumentationNotAvailableException is thrown. It means the repo/branch exists but contains no recognizable documentation pages under DocsRoot.

Solutions

  1. Verify the DocsRoot folder exists in the target repo/branch and contains files matching IsDocPage's expectations (extension/naming)
  2. Check the repo/branch actually has content (e.g. view it remotely) and switch to a branch that does
  3. Catch DocumentationNotAvailableException and render an empty/fallback docs state with a retry
  4. Update DocumentationConstants.DocsRoot to the restructured path if the docs layout changed

Example fix

// before
var sections = await documentationService.GetSectionsAsync();
// after
try { var sections = await documentationService.GetSectionsAsync(); }
catch (DocumentationNotAvailableException ex)
{
    logger.LogWarning(ex, "Docs empty/unavailable");
    // fallback: cached docs or empty state
}
Defensive patterns

Strategy: fallback

Validate before calling

// verify docs folder has doc pages before calling the service
var tree = await gitApi.ListDocsPaths(Owner, RepoName, Branch);
var docPages = tree.Where(p => p.StartsWith(DocumentationConstants.DocsRoot + "/") && p.EndsWith(".md")).ToList();
if (docPages.Count == 0)
    throw new DocumentationNotAvailableException("No doc pages under DocsRoot");

Try / catch

List<string> paths;
try
{
    paths = await docs.GetSectionsAsync(); // may throw DocumentationNotAvailableException
}
catch (DocumentationNotAvailableException)
{
    paths = LoadCachedDocsPaths() ?? new List<string>();
}

Prevention

When it happens

Trigger: Calling GetSectionsAsync when the configured DocumentationConstants.DocsRoot folder is missing from the repo, was renamed, contains no files passing IsDocPage (e.g. no .md pages at the expected prefix), or the branch was pushed empty/incomplete.

Common situations: Docs repo restructured so markdown files moved out of DocsRoot; a new/empty branch checked out; file-extension conventions changed so IsDocPage filters everything out; partial clone or CDN serving stale tree data.

Understand the failure class

Background: EmptyResultError / "no results found": when an API or scraper succeeds but returns zero rows — this error's family across 9 libraries.

Related errors


AI-assisted analysis of LykosAI/StabilityMatrix@af93d6ef57 (2026-09-12). Data as JSON: /api/errors/85e5b945fcda39fc. Report an issue: GitHub.

Appendix: source

Thrown at StabilityMatrix.Core/Services/DocumentationService.cs:184

        catch (NotFoundException e)
        {
            throw new DocumentationNotAvailableException("Documentation repository or branch not found.", e);
        }

        cancellationToken.ThrowIfCancellationRequested();

        var prefix = DocumentationConstants.DocsRoot + "/";

        var paths = tree
            .Tree.Where(item =>
                item.Type == TreeType.Blob && item.Path.StartsWith(prefix, StringComparison.Ordinal)
            )
            .Select(item => item.Path[prefix.Length..])
            .Where(IsDocPage)
            .ToList();

        if (paths.Count == 0)
            throw new DocumentationNotAvailableException(
                "Documentation folder is empty or not available yet."
            );

        return paths;
    }

    /// <summary>
    /// Whether a docs-relative path should be shown as a navigable page.
    /// Excludes images, .gitkeep placeholders, and non-markdown files.
    /// </summary>
    private static bool IsDocPage(string docsRelativePath)
    {
        if (docsRelativePath.StartsWith("images/", StringComparison.OrdinalIgnoreCase))
            return false;

        var lastSlash = docsRelativePath.LastIndexOf('/');
        var fileName = lastSlash < 0 ? docsRelativePath : docsRelativePath[(lastSlash + 1)..];
        if (fileName.Equals(".gitkeep", StringComparison.OrdinalIgnoreCase))

View on GitHub (pinned to af93d6ef57)