General copied/pasted code errors

It’s difficult to see where the error comes from. The code runs fine on my system, so it could be OS related.

Do you still have the error when running the following (comment are removed) :

(
TempoClock.default.tempo = 1;
p = Pbind(
    \degree, Pseq([
        Pseries({ rrand(0, 7) }, 1, { rrand(4, 8) }),
        Pseries({ rrand(0, 7) }, 1, { rrand(4, 8) }),
        Pseries({ rrand(7, 14) }, -1, { rrand(4, 8) })
    ], inf),
    \dur, 0.125
).play;
)

Do you still have the error when running the following (indentation is tab characters instead of space characters) :

(
TempoClock.default.tempo = 1;
p = Pbind(
	\degree, Pseq([
		Pseries({ rrand(0, 7) }, 1, { rrand(4, 8) }),
		Pseries({ rrand(0, 7) }, 1, { rrand(4, 8) }),
		Pseries({ rrand(7, 14) }, -1, { rrand(4, 8) })
	], inf),
	\dur, 0.125
).play;
)

For all the tests I have done it does not matter the position of the cursor, you always get the same error message; and in all cases the complete and correct region of code flashes when hitting ctrl+return

Looks very similar to this issue: Code stops working after hitting 252 characters · Issue #6081 · supercollider/supercollider · GitHub

i.e. interprocess communication between IDE and language client is broken somehow.

1 Like

Perhaps this SuperCollider build has a problem?

That’s right @Dindoleon !

The error persists when comments are removed, but it works fine when they are removed AND regular space characters are replaced by indentation tab.

The enigmatic thing is that, once it starts working with these fixes, subsequent executions of the code that previously failed, surprisingly always works, without any additional fixes, until the moment the server is restarted, then the cycle repeats.
That is: directly pasting the first fragment of your code does not work, pasting the second fragment does, and re-executing the first fragment again, now it also works.

I have Windows 10 Pro installed and updated, in a previous fresh instalation I had the same casuistry…

Thank you very much for your interest and help!

1 Like

Thanks a lot for the feedback. At least you have a way to ‘fix’ it. But we’ll have to investigate further to see where the error comes from.

I’m afraid that the error is related to what is discussed in this other post Evaluation problem on Windows. In my case I am experiencing similar errors when creating new files and saving files. Unfortunately no solution was found in this regard.

Post window when creating new file (CTRL+N):

ERROR: syntax error, unexpected NAME, expecting $end
  in interpreted text
  line 1 char 23:

  -4413-8450-75052c9e84c8}');ScIDE.currentPath_(nil); 
                  ^^^^^^^
-----------------------------------
ERROR: Command line parse failed

Post window when Saving file:

WARNING: Attempted to modify missing Text Mirror for Document {e4b9c291-d420-4413-8450-75052c9e84c8}
ERROR: syntax error, unexpected ',', expecting $end
  in interpreted text
  line 1 char 1:

  ,110,100,32,108,105,110,101,32,112,97,114,115,101,32,102,97,105,108,101,100,10,10,10,10,10,10,10,], 0, [67,58,47,116,109,112,47,115,103,97,115,100,46,115,99,100,], 249, 0) 
  ^
-----------------------------------
ERROR: Command line parse failed

Also, after this errors I get this error in the Post Window when pasting some text in the IDE:

WARNING: Attempted to modify missing Text Mirror for Document {e4b9c291-d420-4413-8450-75052c9e84c8}
ERROR: Message 'prSetEdited' not understood.
RECEIVER:
   nil
ARGS:
   Integer 1
CALL STACK:
	DoesNotUnderstandError:reportError
		arg this = <instance of DoesNotUnderstandError>
	Nil:handleError
		arg this = nil
		arg error = <instance of DoesNotUnderstandError>
	Thread:handleError
		arg this = <instance of Thread>
		arg error = <instance of DoesNotUnderstandError>
	Object:throw
		arg this = <instance of DoesNotUnderstandError>
	Object:doesNotUnderstand
		arg this = nil
		arg selector = 'prSetEdited'
		arg args = [*1]
	Process:interpretCmdLine
		arg this = <instance of Main>
^^ ERROR: Message 'prSetEdited' not understood.
RECEIVER: nil

By the way thanks for your time, answers and interest!

Does the linked video in the following thread in the issues section for SuperCollider on github show your problem?

It would seem that the ScIDE class fails to initialize properly.

It feels like when initializing, it interprets a string at some point, which somehow leaves a parenthesis or similar open. Then, later, it tries to interpret an other string, encounters a character that shouldn’t be present until what it opened previously was closed, thus raising an error.

I might be wrong, but I think that this might be related to the communication with the OS, and specifically, with Windows OS. Maybe when trying to access a path, it gets a collision between a character and an opening parenthesis instruction ? What is your locale language ? Are the path of your SuperCollider folders (both SC install folder and saved projects folder) containing white spaces, or accentuated characters ?

yes @prko, that is the case.

My locale is Spanish (Spain)
Paths:
C:\Users\lpeiro\AppData\Local\SuperCollider
C:\Program Files\SuperCollider-3.12.1

Could you try using after selecting “Beta: Use Unicode UTF-8 for worldwide language support”?

It will not solve the problem, but it will reduce the frequency of the problem.

ok, thanks! I will try for a while; for the moment the problem persists :frowning:

Ah… I see this was reported before, in the other thread, but I overlooked an implication at that time.

I could imagine a couple of reasons for the class of error. One is that the IDE could be mis-identifying the boundaries of the code to execute. (That’s why I asked about cursor position – this cause might be sensitive to the cursor and/or selection.)

The other is incomplete transmission of the code to execute.

New document, copy/paste etc are running code that is generated by the IDE, not extracted from an open document. The fact that it’s happening for these as well as for code that you wrote means that it can only be a transmission bug. So, investigation can focus on the IPC layer. (Narrowing the scope of the investigation is very useful!)

Still unknown is why the same IDE/sclang source code doesn’t break in Mac and Linux, and doesn’t break in most Windows installs, but does break in some specific environments (with the same source code…). Boost problem maybe?

hjh

Brilliant! I have been imagining for some time how I can contribute to the development of this wonderful community given my limited abilities, so I love knowing that in some way this can be of some use :))

For what it’s worth, I’ve also noticed the following behavior:

  1. Start supercollider (without booting the server)
  2. Run “conflicting code” (valid code that produces unjustified errors)
  3. Observe that the code has been interpreted happily (although, obviously, the audio is not heard)

  1. Start the server
  2. Run the “conflicting code” again
  3. The error now occurs

1 Like

By the way, I have uninstalled my antivirus client, disabled Windows Defender and manually added exceptions in the Windows firewall for sclang.exe, scsynth.exe, scide.exe and supernova.exe, but this does not solve the problem either

@prko opened a new issue on GitHub to track the problem.

avdrd found a fix for this issue here, but it still persists.

Sorry for the double post.

The file TextLexerBrutal.sc states that

// whether or not to include ^ in any alphabets. Can’t do it right now,
// because ^ will cause unwanted early termination when interpreted.

I think that the issues mentioned earlier are likely due to such an ‘early termination’.

In my user folder, I found a file, editor.js, that could be related to the problem.

“Early termination” refers to:

+ Collection {
    myMethod { |sentinel, func|
        this.do { |item|
            if(func.value(item, sentinel)) {
                ^item  // here is early termination of the loop
            }
        };
        ^nil
    }
}

That is, ^ behaves this way in a SC class definition. This meaning of ^ is specific to sclang code and should not be assumed to be the same for computer languages in general.

In a string, ^ is just a character, nothing special about it.

The problem in this thread is all taking place in C++, which uses the keyword return to early-exit a function. In C++, there’s no early termination associated with ^.

Interesting that it’s booting the server that messes up the IPC. Those should be independent: IPC is IDE ↔ sclang, booting the server is sclang ↔ server. When the server is running, the IDE does send its own /status requests directly to the server, but that’s through a network socket, which also shouldn’t affect IPC.

hjh

1 Like

Someone who encounters this should get a debug build up and trace the data flow in a debugger. I believe text goes out here: https://github.com/supercollider/supercollider/blob/a0644a73788516e406bf1ceebc1f0f6a950e333e/editors/sc-ide/core/sc_process.cpp#L212

and comes in here: https://github.com/supercollider/supercollider/blob/a0644a73788516e406bf1ceebc1f0f6a950e333e/lang/LangSource/SC_TerminalClient.cpp#L317

Although I’m less certain on the language client side.