Skip to content

Tool (write_to_file/apply_diff/etc..) execution results in false failure due to improper handling of Java diagnostics error #2490

@HarukiKosuda2930

Description

@HarukiKosuda2930

App Version

3.11.12

API Provider

Ollama

Model Used

qwen2.5-coder

Actual vs. Expected Behavior

Even when write_to_file successfully updates a file, an error is still reported.

In the getNewDiagnostics function located at src\integrations\diagnostics\index.ts, issues are retrieved after rewriting the file. However, the function does not expect a folder path to be returned and tries to open it as a document, which results in an exception.
Although the file is updated successfully, an error is reported to the LLM, causing it to become confused and unable to proceed with the task.

src\integrations\diagnostics\index.ts 96-

					case vscode.DiagnosticSeverity.Hint:
						label = "Hint"
						break
					default:
						label = "Diagnostic"
				}
				const line = diagnostic.range.start.line + 1 // VSCode lines are 0-indexed
				const source = diagnostic.source ? `${diagnostic.source} ` : ""
				const document = documents.get(uri) || (await vscode.workspace.openTextDocument(uri)) ←

It may not be a problem specific to Roo, and it might also reproduce in Cline. Sorry, but I haven’t investigated that part.

Detailed Steps to Reproduce

  1. Install the Java plugin and open a Spring Boot 3.x project folder in VSCode.
    In my environment, diagnostics are generated for folders like the following, although the exact conditions under which they are generated are unknown:
[{
	"resource": "/H:/sample/",
	"owner": "_generated_diagnostic_collection_name_#5",
	"code": "964",
	"severity": 8,
	"message": "Project 'sample' is missing required source folder: 'build/generated/aotTestSources'",
	"source": "Java",
	"startLineNumber": 1,
	"startColumn": 1,
	"endLineNumber": 1,
	"endColumn": 1
}]
  1. Use Roo to edit some files through the tool.

  2. Although the file is updated successfully, the tool reports that the operation has failed.

Relevant API Request Output

Additional Context

No response

Metadata

Metadata

Assignees

Labels

Issue - In ProgressSomeone is actively working on this. Should link to a PR soon.bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions