Code search: some queries 500 (Forgejo explore.Code panic, index out of range) #113
Etiketter
Inga etiketter
area/backups
area/ci
area/control-panel
area/identity
area/infra
area/observability
area/payments
area/security
area/storage
area/web
blocked
needs-info
needs-triage
ready-for-implementation
type
bug
type
chore
type
docs
type
epic
type
feature
type
task
wontfix
Ingen milstolpe
Inget projekt
Inga tilldelade
1 deltagare
Notiser
Förfallodatum
Inget förfallodatum satt.
Beroenden
Inga beroenden satta
Referens
bitborg/bitborg-infra#113
Läser in…
Hänvisa till i nytt ärende
Ingen beskrivning angiven.
Ta bort grenen "%!s()"
Borttagning av en gren är permanent. Även om den borttagna grenen kan fortsätta existera en kort tid innan den faktiskt tas bort, kan det INTE ångras i de flesta fall. Vill du fortsätta?
Found right after enabling zoekt code search (#76, applied to prod 2026-07-18). Instance-wide code search works — real hits for most queries (
gitborg~2000,zoekt,postgres,caddy,REPO_INDEXER,the,defall 200) — but some single-word queries panic with HTTP 500.Repro
Cause (Forgejo-side panic, not our config)
An off-by-one in Forgejo's
explore.Codehandler (v16.0.0) on a specific result-set shape — the "[12] with length 12" hints at a per-repo/per-language array indexed one past its end. Query-specific (not volume:gitborgreturns far more and is fine), reliably triggered byq=ansible.Assessment / actions
forgejo_repo_indexer_enabled=false+ apply remains the escape hatch if it proves worse than thought.explore.Codeindex-out-of-range; file upstream with this repro if absent.bleve(the alternativeforgejo_repo_indexer_type) avoids it, as a stopgap, vs. waiting for an upstream fix.Surfaced by: #76. Instance: Forgejo 16.0.0.
Triage — this is an upstream Forgejo bug, not our config
The panic is in Forgejo's
explore.Codehandler (explore/code.go:25,index out of range [12] with length 12) on Forgejo 16.0.0 — an off-by-one in result rendering, query-specific (q=ansiblereliably; most queries, including far larger result sets likeq=bitborg, are fine). Nothing in our zoekt config triggers or fixes it.Actions taken / recommended
forgejo_repo_indexer_enabled=falseescape hatch, and the (untested)blevestopgap.blevestopgap — evaluate, don't switch prod blind. The panic is in result rendering, so switchingforgejo_repo_indexer_typemay or may not avoid it; it also forces a full reindex. Test in a local/preview instance first.GET /explore/code?q=ansible→ 500;q=ansible%20playbook→ 200) if not already reported, and tracking the fix. (Left to a maintainer with a Codeberg account — I can draft the report text if useful.)Keeping #113 open to track the upstream fix.
Dormant: zoekt was disabled in #165 (2026-07-20), so /explore/code is unreachable and this explore.Code panic can't trigger. Closing — re-verify the panic is fixed as part of the zoekt re-enable gate (Forgejo PR 8106, tracked around #162).