continue icon indicating copy to clipboard operation
continue copied to clipboard

Indexing error and can not rebuild

Open licongy opened this issue 6 months ago • 10 comments
trafficstars

Before submitting your bug report

Relevant environment info

- OS: macOS
- Continue version: 1.1.34
- IDE version: VSCode 1.100.0 (Universal)
- Model: Transformers.js (Build-In model for embed) 
- config:
  
%YAML 1.1
---
name: assistant
version: 0.0.1
schema: v1

openai_defaults: &openai
  provider: openai
  apiKey: *

anthropic_defaults: &anthropic
  provider: anthropic
  apiKey: *

gemini_defaults: &gemini
  provider: gemini
  apiKey: *

option_defaults: &options
  defaultCompletionOptions:
    contextLength: 1047576
    maxTokens: 32768
    temperature: 1
  useLegacyCompletionsEndpoint: false

chat_option_defaults: &chat_options
  chatOptions:
    baseSystemMessage: >-
      *

models:
  - name: Claude 3.7 Sonnet ($15)
    <<: [*anthropic, *chat_options]
    model: claude-3-7-sonnet-latest
    defaultCompletionOptions:
      contextLength: 1047576
      maxTokens: 64000
      temperature: 1

  - name: Gemini 2.5 Pro
    <<: [*gemini, *options, *chat_options]
    model: gemini-2.5-pro-preview-05-06

  - name: Gemini 2.5 Flash
    <<: [*gemini, *options, *chat_options]
    model: gemini-2.5-flash-preview-04-17

  - name: GPT-o1 ($60)
    <<: [*openai, *options, *chat_options]
    model: o1-2024-12-17
  - name: GPT-o3 ($40)
    <<: [*openai, *options, *chat_options]
    model: o3-2025-04-16
  - name: GPT-o1 mini ($4.4)
    <<: [*openai, *options, *chat_options]
    model: o1-mini-2024-09-12
  - name: GPT-o3 mini ($4.4)
    <<: [*openai, *options, *chat_options]
    model: o3-mini-2025-01-31
  - name: GPT-o4 mini ($4.4)
    <<: [*openai, *options, *chat_options]
    model: o4-mini-2025-04-16
  - name: GPT-4.1 ($8)
    <<: [*openai, *options, *chat_options]
    model: gpt-4.1-2025-04-14
  - name: GPT-4.1 mini ($1.6)
    <<: [*openai, *options, *chat_options]
    model: gpt-4.1-mini-2025-04-14
  - name: GPT-4.1 nano ($0.4)
    <<: [*openai, *options, *chat_options]
    model: gpt-4.1-nano-2025-04-14
  - uses: ollama/qwen2.5-coder-1.5b

context:
  - provider: code
  - provider: docs
  - provider: diff
  - provider: terminal
  - provider: problems
  - provider: folder
  - provider: codebase

mcpServers:
  - uses: anthropic/memory-mcp
  - uses: exa/exa-mcp
    with:
      EXA_API_KEY: *
    override:
      args:
        - -y
        - exa-mcp-server
        - --tools=web_search,research_paper_search,twitter_search

Description

My indexes don't work properly and I can't rebuild them. I've tried Continue: Rebuild codebase indexes, Continue: Codebase Force Re-index and Continue: Docs Force Re-index and it all failed.

To reproduce

Don't know how to reproduce.

I have indexing working fine in two other projects.

In this project where indexing is not working, there are 15 larger markdown project files (50-80kb each, with a multi-level structure, but some level with a large amount of content, above 10k tokens). I'm not sure if this is the cause of the issue.

Also there were originally 10 .docx files that were previously removed.

Log output

[Extension Host] error when indexing:  Error: SQLITE_ERROR: no such table: tag_catalog
--> in Database#prepare('SELECT path, cacheKey, lastUpdated FROM tag_catalog\n' +
  '    WHERE dir = ? AND branch = ? AND artifactId = ?', 'file:///Users/username/docspace/ProjectName', 'master', 'chunks', [Function (anonymous)])
	at new Promise (<anonymous>)
log.ts:460   ERR [Extension Host] Error: SQLITE_IOERR: disk I/O error
--> in Database#exec('CREATE TABLE IF NOT EXISTS code_snippets (\n' +
  '        id INTEGER PRIMARY KEY,\n' +
  '        path TEXT NOT NULL,\n' +
  '        cacheKey TEXT NOT NULL,\n' +
  '        content TEXT NOT NULL,\n' +
  '        title TEXT NOT NULL,\n' +
  '        signature TEXT,\n' +
  '        startLine INTEGER NOT NULL,\n' +
  '        endLine INTEGER NOT NULL\n' +
  '    )', [Function (anonymous)])
	at new Promise (<anonymous>)
	at async Promise.all (index 0)
error @ log.ts:460
console.ts:137 [Extension Host] Error: SQLITE_IOERR: disk I/O error
--> in Database#exec('CREATE TABLE IF NOT EXISTS code_snippets (\n' +
  '        id INTEGER PRIMARY KEY,\n' +
  '        path TEXT NOT NULL,\n' +
  '        cacheKey TEXT NOT NULL,\n' +
  '        content TEXT NOT NULL,\n' +
  '        title TEXT NOT NULL,\n' +
  '        signature TEXT,\n' +
  '        startLine INTEGER NOT NULL,\n' +
  '        endLine INTEGER NOT NULL\n' +
  '    )', [Function (anonymous)])
	at new Promise (<anonymous>)
	at async Promise.all (index 0)
[Extension Host] vscode-redhat-telemetry 0.8.0 (redhat.vscode-yaml): Updating vscode-redhat-telemetry configuration from https://raw.githubusercontent.com/redhat-developer/vscode-redhat-telemetry/main/src/config/telemetry-config.json
console.ts:137 [Extension Host] error when indexing:  Error: SQLITE_IOERR: disk I/O error
--> in Database#exec('CREATE TABLE IF NOT EXISTS tag_catalog (\n' +
  '            id INTEGER PRIMARY KEY AUTOINCREMENT,\n' +
  '            dir STRING NOT NULL,\n' +
  '            branch STRING NOT NULL,\n' +
  '            artifactId STRING NOT NULL,\n' +
  '            path STRING NOT NULL,\n' +
  '            cacheKey STRING NOT NULL,\n' +
  '            lastUpdated INTEGER NOT NULL\n' +
  '        )', [Function (anonymous)])
	at new Promise (<anonymous>)
log.ts:460   ERR [Extension Host] Error: SQLITE_IOERR: disk I/O error
--> in Database#exec('CREATE TABLE IF NOT EXISTS code_snippets (\n' +
  '        id INTEGER PRIMARY KEY,\n' +
  '        path TEXT NOT NULL,\n' +
  '        cacheKey TEXT NOT NULL,\n' +
  '        content TEXT NOT NULL,\n' +
  '        title TEXT NOT NULL,\n' +
  '        signature TEXT,\n' +
  '        startLine INTEGER NOT NULL,\n' +
  '        endLine INTEGER NOT NULL\n' +
  '    )', [Function (anonymous)])
	at new Promise (<anonymous>)
	at async Promise.all (index 0)
error @ log.ts:460
console.ts:137 [Extension Host] Error: SQLITE_IOERR: disk I/O error
--> in Database#exec('CREATE TABLE IF NOT EXISTS code_snippets (\n' +
  '        id INTEGER PRIMARY KEY,\n' +
  '        path TEXT NOT NULL,\n' +
  '        cacheKey TEXT NOT NULL,\n' +
  '        content TEXT NOT NULL,\n' +
  '        title TEXT NOT NULL,\n' +
  '        signature TEXT,\n' +
  '        startLine INTEGER NOT NULL,\n' +
  '        endLine INTEGER NOT NULL\n' +
  '    )', [Function (anonymous)])
	at new Promise (<anonymous>)
	at async Promise.all (index 0)
bws @ console.ts:137
console.ts:137 [Extension Host] error when indexing:  Error: SQLITE_IOERR: disk I/O error
--> in Database#exec('CREATE TABLE IF NOT EXISTS tag_catalog (\n' +
  '            id INTEGER PRIMARY KEY AUTOINCREMENT,\n' +
  '            dir STRING NOT NULL,\n' +
  '            branch STRING NOT NULL,\n' +
  '            artifactId STRING NOT NULL,\n' +
  '            path STRING NOT NULL,\n' +
  '            cacheKey STRING NOT NULL,\n' +
  '            lastUpdated INTEGER NOT NULL\n' +
  '        )', [Function (anonymous)])
	at new Promise (<anonymous>)
log.ts:460   ERR [Extension Host] Error: SQLITE_IOERR: disk I/O error
--> in Database#exec('CREATE TABLE IF NOT EXISTS code_snippets (\n' +
  '        id INTEGER PRIMARY KEY,\n' +
  '        path TEXT NOT NULL,\n' +
  '        cacheKey TEXT NOT NULL,\n' +
  '        content TEXT NOT NULL,\n' +
  '        title TEXT NOT NULL,\n' +
  '        signature TEXT,\n' +
  '        startLine INTEGER NOT NULL,\n' +
  '        endLine INTEGER NOT NULL\n' +
  '    )', [Function (anonymous)])
	at new Promise (<anonymous>)
	at async Promise.all (index 0)
error @ log.ts:460
error @ log.ts:565
error @ logService.ts:51
wws @ remoteConsoleUtil.ts:58
$logExtensionHostMessage @ mainThreadConsole.ts:38
S @ rpcProtocol.ts:458
Q @ rpcProtocol.ts:443
M @ rpcProtocol.ts:373
L @ rpcProtocol.ts:299
(anonymous) @ rpcProtocol.ts:161
B @ event.ts:1208
fire @ event.ts:1239
fire @ ipc.net.ts:652
l.onmessage @ localProcessExtensionHost.ts:378
console.ts:137 [Extension Host] Error: SQLITE_IOERR: disk I/O error
--> in Database#exec('CREATE TABLE IF NOT EXISTS code_snippets (\n' +
  '        id INTEGER PRIMARY KEY,\n' +
  '        path TEXT NOT NULL,\n' +
  '        cacheKey TEXT NOT NULL,\n' +
  '        content TEXT NOT NULL,\n' +
  '        title TEXT NOT NULL,\n' +
  '        signature TEXT,\n' +
  '        startLine INTEGER NOT NULL,\n' +
  '        endLine INTEGER NOT NULL\n' +
  '    )', [Function (anonymous)])
	at new Promise (<anonymous>)
	at async Promise.all (index 0)

licongy avatar May 11 '25 11:05 licongy

try to wipeout ~/.continue/index and Reload Window.

FelikZ avatar May 13 '25 07:05 FelikZ

The indexing throw error when I checkout branch. In my case, I checkout branch from a fix branch to master branch, the indexing throw error:

Error: SQLITE_CONSTRAINT: UNIQUE constraint failed: chunk_tags.tag, chunk_tags.chunkId

If I retry indexing, continue will throw a new error

Error: SQLITE_IOERR: disk I/O error

nnsay avatar May 16 '25 02:05 nnsay

I get the same error after switching branches and trying to reindex Error: SQLITE_CONSTRAINT: UNIQUE constraint failed: chunk_tags.tag, chunk_tags.chunkId

ahmdgawad avatar May 16 '25 10:05 ahmdgawad

same here Error: SQLITE_CONSTRAINT: UNIQUE constraint failed: chunk_tags.tag, chunk_tags.chunkId

IJOL avatar May 18 '25 13:05 IJOL

The same here too, I'm using a devcontainer in Windows 11 Pro.

XavierBeheydt avatar May 22 '25 09:05 XavierBeheydt

@licongy if you ignore the entire project using a .continueignore file containing * does it work? You can use this to hone in on which files/folders are the problem

@nnsay does it only happen on switching git branches, is there a clear correlation?

@XavierBeheydt if you open the project outside a dev container do you have the same error?

RomneyDa avatar May 26 '25 23:05 RomneyDa

@XavierBeheydt if you open the project outside a dev container do you have the same error?

Yes I have.

XavierBeheydt avatar May 27 '25 12:05 XavierBeheydt

@nnsay does it only happen on switching git branches, is there a clear correlation?

Switching branch is a way to reproduce the issue. I think there is a bug for indexing because the indexing is ok in last version. In the last version, if you switch branch, the continue will create new indexing for the branch and the indexing database should be found in ~/.continue/index/lancedb and you can find the branch name in database file name.

If you work on single branch, it is ok.

nnsay avatar May 30 '25 06:05 nnsay

In case it's helpful...

I was also seeing the same error when using 'Open Folder...' on an ASP.net 4.8 project which includes a mix of Javascript and XML, and some old VBScript ASP Classic. The project is 4.84 Gb in size, 35,181 files, 4,571 folders.

The initializing step completed The 'Discovering files' step completed The 'Planning changes for chunk index...' took many minutes and then failed with the reported SQLLITE chunk error. Re-indexing did not help

As suggested above, I deleted the ~/.continue/index folder. This worked for me and indexing completed successfully.

Relevant info

  • OS: Windows 10
  • Continue version: 1.0.11
  • IDE version: VSCode 1.100.2 (user setup)
  • Model: Qwen Coder 7b
  • config: N/a

Other info

  • A separate ASP.net Core MVC project worked while I was having the problem with the project above
  • Indexing on another client computer appeared to work on the same project, but this was several days before I encountered the problem and might have been a slightly older Continue version
  • The folder is on a network drive accessed via SMB with a mapped drive letter
  • The ~/.continue/index/lancedb folder did not contain a folder for the affected project, but it did contain one for the project that worked

robw-ddsn avatar Jun 03 '25 02:06 robw-ddsn

Image

I was not OK with this plugin rushing to index all my project right after installation (at least until I understood the basics of how it works), so I immediately disabled indexing. Now I tried to Resume indexing, and it broke because of SQL.

I tried "Click to retry" -> Rebuild, and now the index.sqlite is corrupted beyond opening it with DB Browser for SQLite.

ratijas avatar Jun 13 '25 21:06 ratijas

I am getting this error also on a macOS 15.4.1 with VSCode 1.101.2 and Continue 1.0.17.

When this error happens, I click the option "Click to retry" it opens a dialog that says:

Rebuild codebase index Your index appears corrupted. We recommend clearing and rebuilding it, which may take time for large codebases.

For a faster rebuild without clearing data, press 'Shift + Command + P' to open the Command Palette, and type out 'Continue: Force Codebase Re-Indexing' Cancel [Button] Rebuild [Button]

If I click "Rebuild" then it throws a different error: "Error: SQLITE_IOERR: disk I/O error". This last errors seem to happen because there are more than one instance of VSCode opened and using Continue, as it is described in #2060 (that I think it will be fixed after a version that includes #6554 will be released.

I mention all this here to keep our eyes open with the next version that includes the feature of the PR, because this issue may be caused also for having different instances of VSCode opened and using Continue.

ivanhercaz avatar Jul 13 '25 12:07 ivanhercaz

This issue hasn't been updated in 90 days and will be closed after an additional 10 days without activity. If it's still important, please leave a comment and share any new information that would help us address the issue.

github-actions[bot] avatar Oct 12 '25 02:10 github-actions[bot]

Analysis & Debugging Guidance for Contributors

This issue involves SQLite database corruption during indexing, particularly when switching Git branches or running multiple VSCode instances. The root cause appears to be a combination of: (1) improper cleanup of branch-specific data in the chunk_tags table causing UNIQUE constraint violations, and (2) concurrent write conflicts between multiple Continue instances.

Key areas to investigate:

  • The chunk_tags table's UNIQUE constraint handling in ChunkCodebaseIndex.ts:83-92 needs better duplicate detection before insertion
  • Branch switching logic in refreshIndex.ts should properly clean up old branch data before indexing new content
  • The IndexLock mechanism needs strengthening to prevent concurrent database writes

To reproduce: Create a project with large markdown files (50-80KB), index on one branch, switch branches, then trigger reindex. For concurrent issues, open multiple VSCode windows and trigger indexing simultaneously.

Quick workaround: Delete ~/.continue/index folder and reload the window. For a proper fix, we need to improve transaction handling, add proper rollback logic on errors, and implement branch-aware cleanup before reindexing.

If you'd like to help debug, please enable verbose logging, capture the exact sequence of operations before the error, and check if PR #6554 (addressing concurrent access) resolves your specific case.

bdougie avatar Oct 17 '25 05:10 bdougie