LykosAI/StabilityMatrix · error · InvalidOperationException
CivArchive detail page was missing model data
Error message
CivArchive detail page was missing model data
What it means
GetModelDetailsAsync throws InvalidOperationException when pageProps exists but pageProps.Model is null — the detail page data loaded but carries no model object. This happens after redirect handling when the final payload still lacks the model.
Solutions
- Confirm the model still exists by opening its URL in a browser
- Update CivArchiveDetailPageResponse mapping if the model key changed
- Treat as entity-not-found and remove/stale-mark the local model
- Check the self-redirect guard logic if a redirect loop was involved
Example fix
// before
var model = pageProps.Model ?? throw new InvalidOperationException("CivArchive detail page was missing model data");
// after
if (pageProps.Model is null) throw new InvalidOperationException($"CivArchive model not found: {relativeUrl}"); Defensive patterns
Strategy: fallback
Validate before calling
var resp = await GetNextDataAsync<CivArchiveDetailPageResponse>(path, ct); bool modelPresent = resp?.PageProps?.Model is not null;
Type guard
bool HasModel(CivArchiveDetailPageResponse r) => r?.PageProps?.Model is not null;
Try / catch
try { return await api.GetModelDetailsAsync(url); }
catch (InvalidOperationException) { /* treat as not-found */ return null; } Prevention
- Treat null model as entity-not-found in sync logic
- Stale-mark local models when detail fetch returns no model
- Re-check after CivArchive schema updates
- Verify existence in a browser when debugging
When it happens
Trigger: Calling GetModelDetailsAsync for a model whose page renders but whose __NEXT_DATA__ has pageProps without a model (e.g. soft-deleted model, suspended content, schema change moving model under a new key).
Common situations: Model removed or made unavailable on Civitai/CivArchive, site restructure relocating the model node in pageProps, race between listing data and detail page state.
Related errors
- CivArchive list page was missing pageProps
- CivArchive detail page was missing pageProps
- GetUserAccount did not contain an id
- Relative URL is required
- Relative URL did not contain a route path
AI-assisted analysis of LykosAI/StabilityMatrix@af93d6ef57 (2026-09-12).
Data as JSON: /api/errors/29a0d3317deb8250.
Report an issue: GitHub.
Appendix: source
Thrown at StabilityMatrix.Core/Api/CivArchiveApiClient.cs:201
// at the model's primary version instead of pageProps.model — follow it like the
// browser would. Guarded against self-redirects so a server quirk can't loop us.
if (
pageProps.Model is null
&& !string.IsNullOrWhiteSpace(pageProps.RedirectUrl)
&& BuildDetailDataPath(pageProps.RedirectUrl) != nextDataPath
)
{
var redirected = await GetModelDetailsAsync(pageProps.RedirectUrl, cancellationToken);
detailsCache.Add(
nextDataPath,
new CacheEntry<CivArchiveModelDetailsResponse>(DateTimeOffset.UtcNow, redirected)
);
return redirected;
}
var model =
pageProps.Model
?? throw new InvalidOperationException("CivArchive detail page was missing model data");
// The API returns version, platform, and platform_name as siblings of model
// under pageProps, so merge them into the model object
if (pageProps.Version is not null)
{
model.Version = pageProps.Version;
}
model.Platform ??= pageProps.Platform;
model.PlatformName ??= pageProps.PlatformName;
var detailsResult = new CivArchiveModelDetailsResponse { Model = model };
detailsCache.Add(
nextDataPath,
new CacheEntry<CivArchiveModelDetailsResponse>(DateTimeOffset.UtcNow, detailsResult)
);
return detailsResult;
}View on GitHub (pinned to af93d6ef57)