-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Open
Labels
coreAnything pertaining to core functionality of the application (opencode server stuff)Anything pertaining to core functionality of the application (opencode server stuff)
Description
Bug Description
The Edit tool occasionally writes hash prefix markers into the actual file content instead of just using them as internal line references.
Example of corrupted output:
#KW|'use client';
#KM|
#XW|import { useEffect, useRef, useState } from 'react';
Expected output:
'use client';
import { useEffect, useRef, useState } from 'react';Root Cause
The Edit tool uses internal line references in the format {line_number}#{hash_id} where hash_id is from the set ZPMQVRWSNKTXJBYH. There appears to be a bug where these hash IDs are occasionally written into the actual file content instead of being used purely as internal references.
Impact
- TypeScript/JavaScript files become syntactically invalid
- Build failures
- Requires manual file rewrite to fix
Workaround
Use Write tool (full file rewrite) instead of Edit tool.
Environment
- OpenCode version: Latest
- OS: Linux
Steps to Reproduce
- Use Edit tool to make changes to a TypeScript file
- Observe that hash prefix like
#KW|,#KM|,#XW|appear at the start of lines
Frequency
This has occurred multiple times across different files in this project.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
coreAnything pertaining to core functionality of the application (opencode server stuff)Anything pertaining to core functionality of the application (opencode server stuff)