Problem
Opening a collection whose directory contains many/large markdown files frequently fails with HTTP 500:
Something went wrong while executing your query on 2026-08-07T09:43:37Z. Please include B714:381F55:53211E3:116DD7D1:6A75A8C8 when
reporting this issue.
Refreshing the page succeeds (the folder-scope cache is then populated and works for ~1 day until the cache TTL expires).
Repro
- Connect any private repo with a content directory containing ~20-30 markdown files (>100KB total text) — e.g.
src/content/posts/JavaWebAI/后端基础 with 29 files / 107KB.
- Open the collection listing for that path (either the root or browse into the subfolder).
- First request returns 500; refresh succeeds.
Key diagnostic: reproduced outside PagesCMS
I bypassed PagesCMS entirely and ran the exact same GraphQL query directly against the GitHub API with the repo owner's token:
query($owner: String!, $repo: String!, $expression: String!) {
repository(owner: $owner, name: $repo) {
object(expression: $expression) {
... on Tree {
entries {
name
path
type
object {
... on Blob {
text
oid
byteSize
}
}
}
}
}
}
}
Results:
┌───────────────────────────────────────────────────────────┬─────────────────────────────────────────────────────────────────────────┐
│ Query expression │ Result │
├───────────────────────────────────────────────────────────┼─────────────────────────────────────────────────────────────────────────┤
│ main:src/content/moments (61 files, ~20KB total text) │ ✅ Success, 63 entries returned │
├───────────────────────────────────────────────────────────┼─────────────────────────────────────────────────────────────────────────┤
│ main:src/content/posts/JavaWebAI/后端基础 (29 files, │ ❌ Something went wrong while executing your query (request id │
│ ~107KB total text) │ 1BEE:22F564:373DB47:3919CD7:6A75AD17) │
└───────────────────────────────────────────────────────────┴─────────────────────────────────────────────────────────────────────────┘
So the failure is 100% GitHub-side and depends on the total size of the blobs requested in a single query (in
fetchCollectionDirectoryEntries in lib/github-cache-folders.ts, which fetches every file's full text in one GraphQL call).
Suggested fix
The fetchCollectionDirectoryEntries GraphQL query is fragile for large directories. Options:
1. Batch the blob fetches — fetch the tree without text first, then fetch file contents in small batches (e.g. 10-15 blobs per query), or
2. Add retry with backoff on this query (GitHub's documented workaround for this transient error), and/or
3. Fall back to the REST API (GET /repos/{owner}/{repo}/git/trees/{sha}?recursive=1 + GET /git/blobs/{oid}) when the GraphQL call fails.
Happy to provide any additional details or the full request ids if needed.
---
Problem
Opening a collection whose directory contains many/large markdown files frequently fails with HTTP 500:
Something went wrong while executing your query on 2026-08-07T09:43:37Z. Please include B714:381F55:53211E3:116DD7D1:6A75A8C8 when
reporting this issue.
Refreshing the page succeeds (the folder-scope cache is then populated and works for ~1 day until the cache TTL expires).
Repro
src/content/posts/JavaWebAI/后端基础with 29 files / 107KB.Key diagnostic: reproduced outside PagesCMS
I bypassed PagesCMS entirely and ran the exact same GraphQL query directly against the GitHub API with the repo owner's token: