cocoindex-io / cocoindex-io/cocoindex-code

Windows: stale daemon can preserve missing embeddings env; search output can also crash on GBK consoles

Open
#166 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
2.7k
Forks
217
Avg merge
1d 4h
Merged PRs (30d)
4

Description

Title: Windows: slim uvx cocoindex-code@latest install starts a stale daemon without embeddings; search output can also crash on GBK consoles

Repo: cocoindex-io/cocoindex-code
Version: cocoindex-code 0.2.33
OS: Windows

Summary

There are two separate problems:

  1. A slim uvx cocoindex-code@latest install can start a daemon that lacks sentence_transformers, and later runs keep reconnecting to that stale daemon even after the dependency is added.
  2. ccc search can crash on Windows consoles that use GBK when a result contains Unicode characters not encodable in that code page.

What I ran

First attempt:

uvx --prerelease=explicit --with cocoindex>=1.0.0a16 cocoindex-code@latest index

Observed:

Indexing failed: No module named 'sentence_transformers'

Then I retried with the missing dependency:

uvx --prerelease=explicit --with cocoindex>=1.0.0a16 --with sentence-transformers cocoindex-code@latest index

Observed:

Indexing failed: No module named 'sentence_transformers'

The dependency was actually present in the environment. These checks succeeded:

uv run --with sentence-transformers python -c "import sentence_transformers; print(sentence_transformers.__file__)"
uv run --with cocoindex-code --with sentence-transformers python -c "from cocoindex.ops.sentence_transformers import SentenceTransformerEmbedder; print(SentenceTransformerEmbedder)"

Root cause I found locally

  • The first failed run had already started a daemon.
  • Later runs kept reconnecting to that stale daemon.
  • Stopping the daemon and rerunning in a correct environment fixed indexing.

Commands:

uv run --with cocoindex-code --with sentence-transformers python -m cocoindex_code.cli daemon stop
uv run --with cocoindex-code --with sentence-transformers python -m cocoindex_code.cli index

After stopping the stale daemon, indexing succeeded.

Recommended fix

  • If embeddings are required, fail earlier with a direct install hint that points users to the supported cocoindex-code[full] install path.
  • Consider including dependency/environment fingerprinting in the daemon handshake so a client does not reconnect to an incompatible stale daemon.
  • If a required module is missing in the daemon, surface that as a daemon health error and suggest ccc daemon restart after install.

Second issue: Windows console encoding crash

After indexing succeeded, search returned results but then crashed while printing:

uv run --with cocoindex-code --with sentence-transformers python -m cocoindex_code.cli search obsidian --limit 3

Observed traceback tail:

UnicodeEncodeError: 'gbk' codec can't encode character '\u2194' in position 523: illegal multibyte sequence

Recommended fix

  • Emit UTF-8 safely on Windows, or
  • catch UnicodeEncodeError in result printing and fall back to replacement characters.

Notes

  • Installing the supported full tool worked cleanly:
uv tool install --upgrade "cocoindex-code[full]"
ccc index
ccc mcp
  • Once the full tool was installed, indexing worked on local projects and a Markdown notes directory.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the daemon entry point used by python -m cocoindex_code.cli daemon stop and the index command, then inspect how clients reconnect after an environment change. Reproduce the stale-daemon case with and without sentence-transformers, and run search using a GBK console with Unicode results. Done means incompatible daemons report an actionable error or restart path, and search output no longer crashes.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend, cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
50/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.