t
- Dominant language
- TypeScript
- Stars
- 193k
- Forks
- 42.4k
- PR merge metrics
- PR metrics pending
Description
b
> Generated by [errors-fix](https://github.com/microsoft/vscode-engineering/actions/runs/31609705551) · opus48 · 448.6 AIC · ⌖ 12.3 AIC · ⊞ 18.6K · [◷](https://github.com/search?q=repo%3Amicrosoft%2Fvscode+%22gh-aw-workflow-id%3A+errors-fix%22&type=pullrequests)
---
> [!NOTE]
> This was originally intended as a pull request, but PR creation failed. The changes have been pushed to the branch [`fix/external-ingest-malformed-db-330466-243e02ab1fabbd6d`](https://github.com/vscodebot-pr/vscode/tree/fix/external-ingest-malformed-db-330466-243e02ab1fabbd6d).
>
> **Original error:** ERR_API: [2026-08-12T15:14:18.417Z] create pull request in microsoft/vscode failed (attempt 1)
Original error: Validation Failed: {"resource":"PullRequest","code":"custom","field":"fork_collab","message":"fork_collab Fork collab can't be granted by someone without permission"} - https://docs.github.com/rest/pulls/pulls#create-a-pull-request
Retryable: false
Suggestion: This error cannot be resolved by retrying. Please check the error details and fix the underlying issue.
To create the pull request manually:
```sh
gh pr create --title "t" --base main --head vscodebot-pr:fix/external-ingest-malformed-db-330466-243e02ab1fabbd6d --repo microsoft/vscode
```
Show patch preview (75 of 75 lines)
```diff
From 78026087d1effb76f16947e1b06f0157a5d801c3 Mon Sep 17 00:00:00 2001
X-GH-AW-Base-Commit: e4cb02e7392fc625904eb30cc88a31a002f63a7c
From: "github-actions[bot]"
Date: Wed, 12 Aug 2026 15:05:43 +0000
Subject: [PATCH] fix: recreate corrupt external-ingest SQLite db on open
(fixes #330466)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---
.../node/codeSearch/externalIngestIndex.ts | 40 ++++++++++++++++---
1 file changed, 34 insertions(+), 6 deletions(-)
diff --git a/extensions/copilot/src/platform/workspaceChunkSearch/node/codeSearch/externalIngestIndex.ts b/extensions/copilot/src/platform/workspaceChunkSearch/node/codeSearch/externalIngestIndex.ts
index acc320a46f4..fa5fafd7fb7 100644
--- a/extensions/copilot/src/platform/workspaceChunkSearch/node/codeSearch/externalIngestIndex.ts
+++ b/extensions/copilot/src/platform/workspaceChunkSearch/node/codeSearch/externalIngestIndex.ts
@@ -607,13 +607,23 @@ export class ExternalIngestIndex extends Disposable {
const storedVersion = this.getStoredCacheVersion(db);
if (storedVersion === ingestUtils.cacheVersion()) {
- this._logService.trace(`ExternalIngestIndex: Cache version matches (${ingestUtils.cacheVersion()})`);
- return db;
- }
+ // The cache version matches, but the database file may still be corrupt on disk.
+ // A shallow read (such as the cache version lookup above) can succeed even when
+ // other pages are malformed, causing `database disk image is malformed` to surface
+ // later during reconciliation. Validate the whole file up front so a corrupt
+ // database is recreated instead of being adopted.
+ if (this.isDatabaseHealthy(db)) {
+ this._logService.trace(`ExternalIngestIndex: Cache version matches (${ingestUtils.cacheVersion()})`);
+ return db;
+ }
- // Version mismatch - close and delete
- this._logService.info(`ExternalIngestIndex: Cache version mismatch (stored:
... (truncated)
```
Contributor guide
Research direction
The proposed change is in extensions/copilot/src/platform/workspaceChunkSearch/node/codeSearch/externalIngestIndex.ts, on the fix/external-ingest-malformed-db-330466-243e02ab1fabbd6 branch. Start by reading the database-opening path and the supplied patch preview. Done means corrupt external-ingest SQLite databases are recreated on open instead of causing a later malformed-database error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- sqlite, typescript
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 20/100