Comiling not possible. ERROR #16006
Hello dear developers,
I am currently doing an internship and learning about InterSystems IRIS and ObjectScript and have downloaded and installed the community version of IRIS.
I have not made any changes in the Management Portal.
In Visual Studio Code I have loaded the InterSystems ObjectScript Extension Pack.
If I now want to compile a file, VSC throws an error:
"ERROR #16006: Document name 'x.csp' is invalid"

The name of the file is "index.csp"
This error also appears when I try to compile other files.
I have noticed that the first 4 characters of the name are always missing.
The error occurs with the file "index_test.csp":
"ERROR #16006: Document name 'x_test.csp' is invalid"

Do I have to make another setting? or is the problem somewhere else?
Kind regards
Comments
underscore is not allowed in names and variables
underscore is the string concatenation operator
Did you put your files in a src subfolder of the folder you opened in VS Code? If not, please close the files in VS Code, create a src subfolder, drag your CSP files into it, then open one and try saving it.
Thank you very much, that has helped me. But now I get another error message that I can't do anything with:
"Non-JSON response to /iris/api/atelier/v8/GOERKE/doc/csp%5Cindex.csp?ignoreConflict=1 request. Is the web server suppressing detailed errors?"
@Daniel Goerke
What learning course/training steps are you following? Do you mean to be creating CSP files? CSP files need to be stored inside a web application so they can be served by the web server. They can't be created as standalone files without that context. Therefore, you need to have the CSP file in folders that tell VS Code what web application it goes it. For example, if you want to create mypage.csp in web application /csp/user, the path to the file inside your local workspace should be something like src/csp/user/mypage.csp. You may also find it easier to edit web application files directly on your IRIS server using server-side editing.
I'm not following any particular path. I wanted to work on it outside of my internship and create and test a few little things myself to get a feel for it.
The compiling and so on is working so far, but is it normal that it recreates the file in the root directory of the namespace?
I'm not sure what you mean by "it recreates the file in the root directory of the namespace". Can you post a screenshot? Also, can you describe in more detail what you're trying to test? We will be able to give better advice with more context.
I think the 2 pictures explain this quite well:
Before compiling:
After compiling:
In the second image, the index.csp has been added at the bottom after compilation. It is also present in the directory:
Thanks for the screenshots. I've never seen that happen before. I just booted up my windows machine and tried to reproduce that behavior but couldn't. If you delete the src/index.csp file and then save src/goerke/index.csp, does src/index.csp re-appear? Do you see any errors or messages in the ObjectScript Output channel?
I just checked the Management Portal and had to change the path of the web application.
The path was at:
C:\InterSystems\IRIS\CSP\goerke\
Then I changed the path to
C:\InterSystems\IRIS\CSP\goerke\src\csp\goerke
And that solved the problem and everything works as it should and I can start programming.
Thank you for your help!
It looks like you used VS Code to directly open the folder (C:\InterSystems\IRIS\CSP\goerke\) which your (local desktop instance) IRIS created for the /csp/goerke webapp it configured when you added a GOERKE namespace using IRIS Portal.
I think this is going to get confusing for you, particularly if you try to use documentation or training material.
Here's what I recommend you do:
1. Close your the folder in VS Code.
2. Copy your C:\InterSystems\IRIS\CSP\goerke into a folder where you will edit your source files, and perhaps in future source-control them with Git. For example, copy it to c:\MyProjects
3. Open the newly-created folder in VS Code (e.g. c:\MyProjects\goerke)
4. Reconfigure your /csp/goerke webapp in IRIS Portal so it points again to C:\InterSystems\IRIS\CSP\goerke
5. Delete all contents of C:\InterSystems\IRIS\CSP\goerke (files and folders), since you already have a copy of these in c:\MyProjects\goerke
Now when you edit a CSP file in VS Code and save it under c:\MyProjects\goerke\src a copy of it will appear in C:\InterSystems\IRIS\CSP\goerke and the /csp/goerke webapp will use this.
When you edit a CLS file in VS Code, saving this writes the class into the GOERKE namespace but doesn't create a file under C:\InterSystems\IRIS\CSP\goerke because IRIS classes live in IRIS databases, not in host OS files.
Everything worked well. Many thanks for the tip.
I have now saved the files to be edited in:
D:\IRIS\src\...
But is it normal that I have to have a separate folder in the "src\csp\"? Because if I simply edit the .csp in the "csp" folder and compile it, I get the "Non-JSON response" error again.
This in itself is not a problem for me, I just want to understand what triggers this error.