LykosAI/StabilityMatrix · error · DocumentationNotAvailableException

Documentation repository or branch not found.

Error message

Documentation repository or branch not found.

What it means

FetchDocsPathsAsync lists the documentation repo contents via a git provider; when the repository or the configured branch does not exist the API throws NotFoundException, which is translated into DocumentationNotAvailableException. It means the configured docs source (repo/branch) cannot be found, so documentation cannot be loaded.

Solutions

  1. Verify DocumentationConstants owner/repo/branch match the actual repository and branch names
  2. Check network connectivity and any proxy settings, then retry
  3. Catch DocumentationNotAvailableException around GetSectionsAsync and show a 'documentation unavailable' fallback UI
  4. Pin the app to a current release whose constants point at an existing branch, or update the constants

Example fix

// before
var sections = await documentationService.GetSectionsAsync();
// after
ReadOnlyCollection<DocsSection> sections;
try
{
    sections = await documentationService.GetSectionsAsync();
}
catch (DocumentationNotAvailableException)
{
    sections = new ReadOnlyCollection<DocsSection>(new List<DocsSection>());
    // show "docs unavailable" state
}
Defensive patterns

Strategy: try-catch

Validate before calling

// pre-check remote docs availability
var head = await httpClient.GetAsync(
    $"https://api.github.com/repos/{DocumentationConstants.Owner}/{DocumentationConstants.RepoName}/branches/{DocumentationConstants.Branch}",
    HttpCompletionOption.ResponseHeadersOnly);
if (!head.IsSuccessStatusCode)
    throw new DocumentationNotAvailableException("Docs repo/branch unreachable");

Type guard

static bool IsDocsRepoConfigured(DocumentationConstants c) =>
    !string.IsNullOrWhiteSpace(c.Owner) && !string.IsNullOrWhiteSpace(c.RepoName) && !string.IsNullOrWhiteSpace(c.Branch);

Try / catch

try
{
    sections = await docs.GetSectionsAsync();
}
catch (DocumentationNotAvailableException ex)
{
    logger.LogWarning(ex, "Docs repo/branch not found");
    ShowDocsUnavailableState();
}

Prevention

When it happens

Trigger: Calling GetSectionsAsync (or FetchDocsPathsAsync directly) when DocumentationConstants.RepoName/Owner/Branch point at a repository or branch that no longer exists, the repo is private without credentials, or there is no network access causing the provider to report not-found.

Common situations: Docs repo renamed or branch renamed (e.g. 'main' -> 'master'); offline or firewalled environment; stale app version pointing at an archived repo; missing/invalid git credentials for a private docs repo.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


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

Appendix: source

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

    private async Task<List<string>> FetchDocsPathsAsync(CancellationToken cancellationToken)
    {
        // Octokit calls don't take a CancellationToken; the tree response is small and
        // the surrounding cache logic still honors cancellation.
        TreeResponse tree;
        try
        {
            tree = await gitHubClient
                .Git.Tree.GetRecursive(
                    DocumentationConstants.Owner,
                    DocumentationConstants.Repo,
                    DocumentationConstants.Branch
                )
                .ConfigureAwait(false);
        }
        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."
            );

View on GitHub (pinned to af93d6ef57)