VS Code
Hi.
I want to save and compile a class in VS Code, but I get the error:
Failed to save 'Utils.cls': Unable to write file 'isfs://mip:mz/API/Utils.cls?project=MZ' (Unknown (FileSystemError): Unknown Error).
Any ideas what is wrong?
Regards,
Matjaž
Comments
You may encounter the error Failed to save 'Utils.cls': Unable to write file 'isfs://mip:mz/API/Utils.cls?project=MZ' (Unknown (FileSystemError): Unknown Error) when trying to save or compile a class in Visual Studio Code due to several potential reasons.
Here are some troubleshooting steps based on relevant information:
-
Do Not Alter First Line of New Files: If you are creating a new file in the Explorer tree in VS Code and modify or delete the first automatically generated line after naming the file (e.g.,
foo.cls), it may cause issues saving the file. Always start coding on the second line and retain the first untouched [1]. -
Namespace and Server Connection Issues: Ensure your connection to the server is functional:
- Check if you have configured the namespace and server connection properly in VS Code.
- Use PuTTY or the browser-based management portal to verify connectivity to the server and test your file import or routine executions, as they should work without errors if connectivity is valid [1].
-
Correct Permissions: Make sure that the user configured for your VS Code ObjectScript plugin has the necessary privileges to write to the namespace or specific filesystems in InterSystems IRIS.
-
VS Code Plugin Setup: Ensure the required InterSystems ObjectScript extensions, such as the ObjectScript Extension Pack and Server Manager, are installed and properly configured [1].
If this doesn't resolve the problem, it may be useful to look at the server logs or other error details in the Audit Trail (%SYS.Audit) to get more information.
Sources:
Hi Matjaž,
This error usually means the VS Code InterSystems Server Manager isn’t properly connected. Check your server settings in VS Code, ensure you're authenticated, and that the namespace mip:mz is reachable. Restarting VS Code might helps here.
Hi Matjaž,
please have a look at the following GitHub issue that was opened on Friday:
"Unable to reopen ISFS document after closing it"
https://github.com/intersystems-community/vscode-objectscript/issues/15…
If your setup is similar to what is covered in that article, you may be able to follow along their discussion, and the forthcoming fix.
Hi.
I just restarted the Intersystems ObjectScript extension from InterSystems ObjectScript Extension Pack to activate the updates (restart was proposed by VS Code) and now it is working without any error.
Tnx all for your replies.
Regards,
Matjaž
Hi Matjaz,
I've encountered a similar issue several times with source code that was correctly saved and compiled using the "old" InterSystems Studio, but not with VS Code.
In my case, it turned out that certain lines of code were causing the saving process to fail.
Specifically, I had to:
- Add parentheses in conditional or loop statements when there's a dot (
.) in the condition (e.g.,if obj.myProperty = "something"→if (obj.myProperty = "something")) - In embedded SQL, when using
INSERTin conjunction withINTO, I had to placeINTOon a new line.
I've also noticed that this doesn't happen in the newest versions of IRIS.
Hope this helps!
Simone
@Matjaz Murko
I just released version 3.0.3 of the vscode-objectscript extension, which contains a fix for this issue.