Skip to content

'Parser fails at 0:0 for TypeScript files with adjacent value + type imports from same module path #1

@srbsa

Description

@srbsa

CodeGraph version: 0.14.0
VS Code version: 1.117.0
OS: macOS (Apple Silicon)

Description

12 TypeScript files in my monorepo fail to parse with Syntax error at 0:0 during indexing. No BOM is present (confirmed via hexdump). The files parse and compile correctly with tsc.

Log output

text

ERROR codegraph_server::backend: Parse failed for "...graph-quality.ts":
  Syntax error in ...graph-quality.ts:0:0: Syntax error in source code

[Error - 18:45:39] Parse error in file:///...graph-quality.ts:
  Syntax error in .../graph-quality.ts:0:0: Syntax error in source code
Minimal reproduction — first 3 lines of a failing file

ts

import { queueInterrupt } from '@platform/db'
import type { DbClient, NodeRow } from '@platform/db'

Pattern across all 12 failing files
All failures share the same structure: a regular value import immediately followed by import type { ... } importing from the same module path (workspace package alias like @platform/db).

Files affected (representative sample)

  • packages/agents/src/shared/graph-quality.ts
  • packages/agents/src/query/loop.ts
  • packages/db/src/queries/nodes/get-by-name.ts
  • packages/db/src/queries/chunks/search-by-embedding.ts
  • packages/worker/src/tasks/process-resolution.ts
  • (8 others with the same import pattern)

Hypothesis

The bundled tree-sitter-typescript grammar version may not handle adjacent import + import type declarations from the same specifier path. The error at 0:0 suggests the parser is rejecting the file before any content is processed, which is unusual for a mid-file syntax issue.

Workaround

None currently — excluding the files is the only option. Splitting import type into a separate file or merging into import { value, type Type } syntax works around it but is not acceptable at scale.

Expected behavior

Files that compile cleanly with tsc should parse without errors

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions