Question
· Jun 15

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ž

Product version: IRIS 2023.2
$ZV: IRIS for Windows (x86-64) 2023.2 (Build 227U) Mon Jul 31 2023 17:45:52 EDT
Discussion (6)6
Log in or sign up to continue

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:

  1. 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].

  2. 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].
  3. 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.

  4. 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 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 INSERT in conjunction with INTO, I had to place INTO on a new line.

I've also noticed that this doesn't happen in the newest versions of IRIS.

Hope this helps!
Simone