create_new_file writes a JSON file on one line when the model sends its contents as a JSON value

Open Beginner friendly
#13,363 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 8 days

@YauhenBichel is already working on this.

Since Oct 9, 2026.

  • #13364 by @YauhenBichel — open

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
72/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
typescript
Domain
devtools

Research direction

The bug is in createNewFileImpl, which reads contents through getStringArg; that helper runs JSON.stringify(value) on objects, which causes the one-line output. Start by reading getStringArg and how createNewFileImpl uses it, then reproduce with the call from the issue. Done means that object contents for a .json file is written as indented JSON (JSON.stringify(value, null, 2)), while other string arguments and the existing tests keep their compact behaviour.

Written by the indexing model from the issue text.

Description

Relevant environment info
  • OS: macOS
  • Continue version: 2.0.0 (also checked on main at 5522c6f)
  • IDE version: VS Code 1.141.0
  • Model: Qwen3.6-Coder 35B, served locally through an OpenAI-compatible API (provider openai)
Description

When a model sends the contents of a new .json file as a JSON value instead of a string, create_new_file writes the file on a single line, for example:

{"name":"app","version":"1.0.0","scripts":{"build":"tsc"},"devDependencies":{"typescript":"^5.6.0"}}

A package.json or tsconfig.json written like this is valid, but nobody would write it that way, and every later edit produces a large diff.

Cause: createNewFileImpl reads the contents with getStringArg, which turns an object back into text with JSON.stringify(value). That compact form is right for other string arguments (and is what the existing tests expect), but for the contents of a file, indented JSON (JSON.stringify(value, null, 2)) is what the model meant.

To reproduce

Call createNewFileImpl({ filepath: "app/package.json", contents: { name: "app", private: true } }, extras): the file is written as {"name":"app","private":true}.

Log output

No response

Dominant language
TypeScript
Stars
36.5k
Forks
5.6k
PR merge metrics
No merged PRs in 30d

Getting set up

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 continuedev/continue

All issues in continuedev/continue

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.