Skip to content

[BUG] TypeError: TextInputSequence must be str when used with codecompanion.nvim #52

@Bekaboo

Description

@Bekaboo

Describe the bug

When codecompanion.nvim uses the provided @vectorcode tools as described in the doc, I get the following error:


Traceback (most recent call last):
  File "/home/user/.local/share/nvim/packages/VectorCode/src/vectorcode/main.py", line 78, in async_main
    return_val = await query(final_configs)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/.local/share/nvim/packages/VectorCode/src/vectorcode/subcommands/query/__init__.py", line 185, in query
    structured_result = await build_query_results(collection, configs)
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/.local/share/nvim/packages/VectorCode/src/vectorcode/subcommands/query/__init__.py", line 82, in build_query_results
    for identifier in await get_query_result_files(collection, configs):
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/user/.local/share/nvim/packages/VectorCode/src/vectorcode/subcommands/query/__init__.py", line 74, in get_query_result_files
    ).rerank(results)
      ~~~~~~^^^^^^^^^
  File "/home/user/.local/share/nvim/packages/VectorCode/src/vectorcode/subcommands/query/reranker.py", line 73, in rerank
    ranks = self.model.rank(
        self.query_chunks[query_chunk_idx], chunk_docs, apply_softmax=True
    )
  File "/home/user/.local/share/pipx/venvs/vectorcode/lib/python3.13/site-packages/sentence_transformers/cross_encoder/util.py", line 68, in wrapper
    return func(self, *args, **kwargs)
  File "/home/user/.local/share/pipx/venvs/vectorcode/lib/python3.13/site-packages/sentence_transformers/cross_encoder/CrossEncoder.py", line 500, in rank
    scores = self.predict(
        sentences=query_doc_pairs,
    ...<5 lines>...
        convert_to_tensor=convert_to_tensor,
    )
  File "/home/user/.local/share/pipx/venvs/vectorcode/lib/python3.13/site-packages/torch/utils/_contextlib.py", line 116, in decorate_context
    return func(*args, **kwargs)
  File "/home/user/.local/share/pipx/venvs/vectorcode/lib/python3.13/site-packages/sentence_transformers/cross_encoder/util.py", line 68, in wrapper
    return func(self, *args, **kwargs)
  File "/home/user/.local/share/pipx/venvs/vectorcode/lib/python3.13/site-packages/sentence_transformers/cross_encoder/CrossEncoder.py", line 399, in predict
    features = self.tokenizer(
        batch,
    ...<2 lines>...
        return_tensors="pt",
    )
  File "/home/user/.local/share/pipx/venvs/vectorcode/lib/python3.13/site-packages/transformers/tokenization_utils_base.py", line 2887, in __call__
    encodings = self._call_one(text=text, text_pair=text_pair, **all_kwargs)
  File "/home/user/.local/share/pipx/venvs/vectorcode/lib/python3.13/site-packages/transformers/tokenization_utils_base.py", line 2975, in _call_one
    return self.batch_encode_plus(
           ~~~~~~~~~~~~~~~~~~~~~~^
        batch_text_or_text_pairs=batch_text_or_text_pairs,
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<17 lines>...
        **kwargs,
        ^^^^^^^^^
    )
    ^
  File "/home/user/.local/share/pipx/venvs/vectorcode/lib/python3.13/site-packages/transformers/tokenization_utils_base.py", line 3177, in batch_encode_plus
    return self._batch_encode_plus(
           ~~~~~~~~~~~~~~~~~~~~~~~^
        batch_text_or_text_pairs=batch_text_or_text_pairs,
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<17 lines>...
        **kwargs,
        ^^^^^^^^^
    )
    ^
  File "/home/user/.local/share/pipx/venvs/vectorcode/lib/python3.13/site-packages/transformers/tokenization_utils_fast.py", line 539, in _batch_encode_plus
    encodings = self._tokenizer.encode_batch(
        batch_text_or_text_pairs,
        add_special_tokens=add_special_tokens,
        is_pretokenized=is_split_into_words,
    )
TypeError: TextInputSequence must be str

To Reproduce
Steps to reproduce the behavior:

  1. :CodeCompanionChat to open chat buffer in neovim
  2. Goto some vectorised repo (in this case the repo of VectorCode itself), start the chat with @full_stack_dev @vectorcode Briefly summarize the project for me
  3. CodeCompanion uses the vectorcode tool with the following XML:
    <tools>
      <tool name="vectorcode">
        <action>
          <command>query</command>
          <options>
            <query>README</query>
            <query>documentation</query>
            <project_root>/home/user/.local/share/nvim/packages/VectorCode</project_root>
            <count>10</count>
          </options>
        </action>
      </tool>
    </tools>
  4. Error

Expected behavior
Should not error.

VectorCode Configuration
Please attach your <project_root>/.vectorcode/config.json or
~/.config/vectorcode/config.json here.

No such file.

For issues with the Neovim plugin, please also attach your setup options:

No setup() called.

If it only occurs when you use VectorCode with a particular plugin, please
attach the relevant config here:

-- VectorCode integration to provide project-level context
local vc = vim.fn.executable('vectorcode') == 1
  and vim.F.npcall(require, 'vectorcode.integrations')

require('codecompanion').setup({
  strategies = {
    chat = {
      adapter = adapter,
      slash_commands = {
        ['codebase'] = vc and vc.codecompanion.chat.make_slash_command(),
      },
      tools = {
        vectorcode = vc
          and {
            description = 'Run VectorCode to retrieve the project context.',
            callback = vc.codecompanion.chat.make_tool(),
          },
      },
  },
})

Platform information:

  • If the issue is about the CLI, attach the output of pipx runpip vectorcode freeze:
annotated-types==0.7.0
anyio==4.9.0
asgiref==3.8.1
backoff==2.2.1
bcrypt==4.3.0
build==1.2.2.post1
cachetools==5.5.2
certifi==2025.1.31
charset-normalizer==3.4.1
chroma-hnswlib==0.7.6
chromadb==0.6.3
click==8.1.8
coloredlogs==15.0.1
Deprecated==1.2.18
distro==1.9.0
durationpy==0.9
fastapi==0.115.12
filelock==3.18.0
flatbuffers==25.2.10
fsspec==2025.3.2
google-auth==2.38.0
googleapis-common-protos==1.69.2
grpcio==1.71.0
h11==0.14.0
httpcore==1.0.7
httptools==0.6.4
httpx==0.28.1
huggingface-hub==0.30.1
humanfriendly==10.0
idna==3.10
importlib_metadata==8.6.1
importlib_resources==6.5.2
Jinja2==3.1.6
joblib==1.4.2
kubernetes==32.0.1
markdown-it-py==3.0.0
MarkupSafe==3.0.2
mdurl==0.1.2
mmh3==5.1.0
monotonic==1.6
mpmath==1.3.0
networkx==3.4.2
numpy==2.2.4
nvidia-cublas-cu12==12.4.5.8
nvidia-cuda-cupti-cu12==12.4.127
nvidia-cuda-nvrtc-cu12==12.4.127
nvidia-cuda-runtime-cu12==12.4.127
nvidia-cudnn-cu12==9.1.0.70
nvidia-cufft-cu12==11.2.1.3
nvidia-curand-cu12==10.3.5.147
nvidia-cusolver-cu12==11.6.1.9
nvidia-cusparse-cu12==12.3.1.170
nvidia-cusparselt-cu12==0.6.2
nvidia-nccl-cu12==2.21.5
nvidia-nvjitlink-cu12==12.4.127
nvidia-nvtx-cu12==12.4.127
oauthlib==3.2.2
onnxruntime==1.21.0
opentelemetry-api==1.31.1
opentelemetry-exporter-otlp-proto-common==1.31.1
opentelemetry-exporter-otlp-proto-grpc==1.31.1
opentelemetry-instrumentation==0.52b1
opentelemetry-instrumentation-asgi==0.52b1
opentelemetry-instrumentation-fastapi==0.52b1
opentelemetry-proto==1.31.1
opentelemetry-sdk==1.31.1
opentelemetry-semantic-conventions==0.52b1
opentelemetry-util-http==0.52b1
orjson==3.10.16
overrides==7.7.0
packaging==24.2
pathspec==0.12.1
pillow==11.1.0
posthog==3.23.0
protobuf==5.29.4
psutil==7.0.0
pyasn1==0.6.1
pyasn1_modules==0.4.2
pydantic==2.11.1
pydantic_core==2.33.0
Pygments==2.19.1
PyPika==0.48.9
pyproject_hooks==1.2.0
python-dateutil==2.9.0.post0
python-dotenv==1.1.0
PyYAML==6.0.2
regex==2024.11.6
requests==2.32.3
requests-oauthlib==2.0.0
rich==14.0.0
rsa==4.9
safetensors==0.5.3
scikit-learn==1.6.1
scipy==1.15.2
sentence-transformers==4.0.1
setuptools==78.1.0
shellingham==1.5.4
shtab==1.7.1
six==1.17.0
sniffio==1.3.1
starlette==0.46.1
sympy==1.13.1
tabulate==0.9.0
tenacity==9.0.0
threadpoolctl==3.6.0
tokenizers==0.21.1
torch==2.6.0
tqdm==4.67.1
transformers==4.50.3
tree-sitter==0.24.0
tree-sitter-c-sharp==0.23.1
tree-sitter-embedded-template==0.23.2
tree-sitter-language-pack==0.6.1
tree-sitter-yaml==0.7.0
triton==3.2.0
typer==0.15.2
typing-inspection==0.4.0
typing_extensions==4.13.0
urllib3==2.3.0
uvicorn==0.34.0
uvloop==0.21.0
-e git+https://github.com/Davidyz/VectorCode.git@4775829c86971f6e2a77f556619a004e324ee4d9#egg=VectorCode
watchfiles==1.0.4
websocket-client==1.8.0
websockets==15.0.1
wrapt==1.17.2
zipp==3.21.0

  • If the issue is about the neovim plugin, attach the neovim version you're using: 0.11

System Information:

  • OS: Linux

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions