One SCIP document that cannot be read fails the whole compiler-tier pass

Open
#1,701 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@KaloyanNaumov is already working on this.

Since Nov 28, 2026.

  • #1704 by @KaloyanNaumov — open

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
20/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Domain
backend

Research direction

Start with scripts/scip_harness/scip_to_delta.py, where each document is parsed with ParseFromString from the vendored scripts/scip_harness/vendor/scip_pb2.py, and run the reproduction snippet in the issue to see the DecodeError. Done means an undecodable document is skipped and logged while the delta keeps the other documents, its prior compiler rows read as stale, a truncated index still fails, and an operator setting can restore the fail-the-pass behaviour. Linked pull request #1704 is already open against this, so check it before starting.

Written by the indexing model from the issue text.

Description

Company

Independent

Component

Code index

Describe what's wrong

One SCIP document that python-protobuf cannot decode fails the whole compiler-tier pass, on every pass. scripts/scip_harness/scip_to_delta.py parses each document with ParseFromString, and a document with a string field that is not valid UTF-8 raises DecodeError: String field had bad UTF-8. The converter exits non-zero, the harness fails, the tier writes no delta and its watermark stays where it was. The next pass indexes the same tree and fails on the same document.

We hit it on the TypeScript tier: scip-typescript wrote a few such documents in a large index, and no pass for that repository completed. Every compiler tier and the full index run through the same converter, so any of them can fail this way on one document.

Does it reproduce on the latest release or main?

Yes

How to reproduce

From a checkout of main, with the server's virtualenv:

import importlib.util, subprocess, sys

spec = importlib.util.spec_from_file_location("scip_pb2", "scripts/scip_harness/vendor/scip_pb2.py")
pb = importlib.util.module_from_spec(spec)
spec.loader.exec_module(pb)

index = pb.Index()
for path, name in (("src/a.cpp", "f"), ("src/bad.cpp", "ZZBADUTF8ZZ")):
    doc = index.documents.add()
    doc.relative_path = path
    occ = doc.occurrences.add()
    occ.symbol = f"scip-clang cxx . . DB/{name}(aa)."
    occ.symbol_roles = pb.SymbolRole.Definition
    occ.range.extend([0, 5, 6])
raw = index.SerializeToString().replace(b"ZZBADUTF8ZZ", b"\xff\xfeBADUTF8ZZ")
open("/tmp/bad.scip", "wb").write(raw)
subprocess.run([sys.executable, "scripts/scip_harness/scip_to_delta.py", "--index", "/tmp/bad.scip",
                "--commit", "h" * 40, "--source-root", "", "--full", "--dry-run", "/tmp/delta.json"])

The run exits 1 and writes no delta, although src/a.cpp is a valid document.

Expected behavior

A file that cannot be processed does not fail the repository's pass. The document that cannot be decoded or converted is skipped and logged, and the delta carries the other documents. The file keeps the compiler rows of its last successful conversion, and they read as stale until a later pass converts it. A full run does not retire them. An index that cannot be read to its end (truncated or corrupt framing) still fails the run. One setting lets an operator fail the pass on such a document instead, as now.

Error message and logs
google.protobuf.message.DecodeError: Error parsing message with type 'scip.Document': String field had bad UTF-8
Environment
Loom 1.3.0 (main 26f8753bc), Python 3.12, protobuf 7.36.2 from the server's virtualenv. Reproduced with the snippet above on main. First seen on a self-managed deployment of the 1.3 line, TypeScript tier, index written by scip-typescript.
How this was found

I found and reproduced it myself

Redaction
  • I removed tokens, keys, passwords and personal or customer data from everything above.
Dominant language
Python
Stars
221
Forks
35
Avg merge
14h 21m
Merged PRs (30d)
873

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

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.

More from ClickHouse/loom

All issues in ClickHouse/loom

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.