Allow editing of svg files #1243

Closed
opened 2026-02-16 17:30:09 -05:00 by yindo · 6 comments
Owner

Originally created by @simonhackler on GitHub (Aug 11, 2025).

Originally assigned to: @thdxr on GitHub.

I created an svg using opencode which works fine.

I want to edit an svg file with opencode and it throws an error.
The error comes from here.

https://github.com/sst/opencode/blob/e9de7f95a7f09975f65241552ee9a5a3cade4089/packages/opencode/src/tool/read.ts#L89
Since svgs files are text files it would be nice to be able to edit them with opencode. The only problem i see is having svg files with embedded images that might unnecesarily consume tokens. These could just be stripped out or replaced by placeholder links. Replacing would be best since then an llm would understand that it doesn't need to do anything for these images.

Ugly workaround is generating svg files with a different file extension and then using them like that.

Originally created by @simonhackler on GitHub (Aug 11, 2025). Originally assigned to: @thdxr on GitHub. I created an svg using opencode which works fine. I want to edit an svg file with opencode and it throws an error. The error comes from here. https://github.com/sst/opencode/blob/e9de7f95a7f09975f65241552ee9a5a3cade4089/packages/opencode/src/tool/read.ts#L89 Since svgs files are text files it would be nice to be able to edit them with opencode. The only problem i see is having svg files with embedded images that might unnecesarily consume tokens. These could just be stripped out or replaced by placeholder links. Replacing would be best since then an llm would understand that it doesn't need to do anything for these images. Ugly workaround is generating svg files with a different file extension and then using them like that.
yindo closed this issue 2026-02-16 17:30:09 -05:00
Author
Owner

@longsman commented on GitHub (Dec 9, 2025):

Also with this issue here: https://github.com/sst/opencode/issues/4781,
I'm currently also trying to edit svg files as well and ran into this related error, I believe someone's working on it so might be able to close this issue also when that's done.

@longsman commented on GitHub (Dec 9, 2025): Also with this issue here: https://github.com/sst/opencode/issues/4781, I'm currently also trying to edit svg files as well and ran into this related error, I believe someone's working on it so might be able to close this issue also when that's done.
Author
Owner

@josiahwiebe commented on GitHub (Dec 9, 2025):

I'm seeing a similar issue crop up, even when the model simply reads an SVG file. I'm not trying to edit an SVG but simply read it. Once it hit that error, I have to start a new session as it will no longer continue.

→ Read public/myltv.svg 

invalid request body, failed to validate schema: (1) Reason: got array, want string, Location: /properties/messages/items/properties/content/oneOf/0/type. (2) Reason: missing property 'type', Location: /properties/messages/items/properties/content/oneOf/1/items/properties/image_url/required.

In this particular case it was using github-copilot/claude-opus-4.5 model.

@josiahwiebe commented on GitHub (Dec 9, 2025): I'm seeing a similar issue crop up, even when the model simply reads an SVG file. I'm not trying to edit an SVG but simply read it. Once it hit that error, I have to start a new session as it will no longer continue. ```bash → Read public/myltv.svg invalid request body, failed to validate schema: (1) Reason: got array, want string, Location: /properties/messages/items/properties/content/oneOf/0/type. (2) Reason: missing property 'type', Location: /properties/messages/items/properties/content/oneOf/1/items/properties/image_url/required. ``` In this particular case it was using `github-copilot/claude-opus-4.5` model.
Author
Owner

@rekram1-node commented on GitHub (Dec 9, 2025):

what version are you on?

@rekram1-node commented on GitHub (Dec 9, 2025): what version are you on?
Author
Owner

@josiahwiebe commented on GitHub (Dec 9, 2025):

I'm on 1.0.138

~ opencode -v
1.0.138
@josiahwiebe commented on GitHub (Dec 9, 2025): I'm on `1.0.138` ```sh ~ opencode -v 1.0.138 ```
Author
Owner

@rekram1-node commented on GitHub (Dec 9, 2025):

ah okay I see

@rekram1-node commented on GitHub (Dec 9, 2025): ah okay I see
Author
Owner

@rekram1-node commented on GitHub (Dec 9, 2025):

fixed in next release:https://github.com/sst/opencode/commit/84a0868e66e1e315963208962d5218c39a549903

@rekram1-node commented on GitHub (Dec 9, 2025): fixed in next release:https://github.com/sst/opencode/commit/84a0868e66e1e315963208962d5218c39a549903
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#1243