org.brainstorm.tree.BstNode[] is not assignable to org.brainstorm.tree.BstNode[]

Hi Brainstorm users,

BS just threw me this error all of a sudden, and I have no idea where to start to troubleshoot this.
This error shows up when I try to load a certain protocol. And I can see that the "intra-subject" folder under Group analysis is not being loaded. I have other protocols and they don't have any issues in loading. I can also seem to create a new protocol without a problem.

I think this error first occurred when I clicked at something in the BS GUI while it was in the middle of some processing, But I could be wrong.

Any help would be appreciated.

First: update Brainstorm (your version of node_create_study does not match the current code).
Second: Reload the entire protocol.

If this doesn't solve the issue: you may have a corrupted file in your database, you need to find which one it is. You could maybe use the Matlab debugger for this. See help on dbstop error, this could stop the debugger when a non-captured error occurs, and let you explore the contents of the variable to find which file is causing this problem. Then remove the file from the database and reload the protocol.

1 Like

Thanks for the suggestion. As I am not familiar with using the Matlab debugger, I just removed the @intra-subject folder (which wasn't loading properly) from the directory, and then created a new protocol by loading from that directory. And somehow the error is now gone.

I recently encountered this same error in Brainstorm version 08-Jul-2025 while working on an automation script for my EEG analysis. This was the initial error thrown by my Matlab script after I had made some seemingly trivial edits:

org.brainstorm.tree.BstNode[] is not assignable to org.brainstorm.tree.BstNode[]

Error in node_create_study (line 553)
        CreatedNodes(iCreatedNode) = parentNode.add(allNodes(iNode).type, ...

Error in panel_protocols>UpdateNode (line 690)
                            node_create_study(nodeStudy, [], sStudy, iStudy, isExpandTrials, UseDefaultChannel, iSearch);

Error in panel_protocols (line 46)
eval(macro_method);

Error in bst_process>Run (line 320)
            panel_protocols('UpdateNode', 'Study', iStudyToRedraw);

Error in bst_process>CallProcess (line 2329)
        OutputFiles = Run(sProcess, sInputs, sInputs2, 0);

Error in bst_process (line 38)
eval(macro_method);

Error in SSVEP_Analysis (line 157)
        sFiles = bst_process('CallProcess', 'process_fft', sFiles, [], ...

Until any analysis files that had been created by the script are deleted and the protocol is reloaded, the files nested within the condition I attempted to analyze fail to load and this error constantly pops up in the brainstorm gui:

** Error: Line 553: org.brainstorm.tree.BstNode[] is not assignable to org.brainstorm.tree.BstNode[]
** 
** Call stack:
** >node_create_study.m at 553
** >panel_protocols.m>CreateStudyNode at 577
** >panel_protocols.m at 46
** >tree_callbacks.m at 113
** >bst_call.m at 28
** >panel_protocols.m>CreatePanel/protocolTreeClicked_Callback at 128
** >bst_call.m at 28
** >panel_protocols.m>@(h,ev)bst_call(@protocolTreeClicked_Callback,h,ev) at 75

Worst of all, the error was following me around, with every condition I attempted to analyze seeming becoming corrupted, failing to load, throwing the above error, and making brainstorm very difficult to use.

After several days of trouble shooting, confusion, creating new protocols, and deleting old analysis files, I finally found the source of the error: when I had run my fast Fourier transform in my script, I defined the electrode variable that passed to the sensortypes argument as "EEG" rather than 'EEG'. Here is an example of code that causes the error:

% Process: Fourier transform (FFT)
        sFiles = bst_process('CallProcess', 'process_fft', sFiles, [], ...
            'timewindow',  window, ...
            'units',       'physical', ...  % Physical: U2/Hz
            'sensortypes', "EEG", ...
            'avgoutput',   1);

Using doubles quotation marks rather than single quotation marks in this context creates corrupted data and renders Brainstorm essentially unusable until the created data is deleted and the protocol is reloaded.

I wanted to share this error and its cause in the hopes that future versions of Brainstorm may be made more robust to use of character variables versus string variables when scripting, or at the very least, produce errors that are actually informative when the wrong variable type is used.

@DanielGurman, thanks for the heads-up.

Indeed we have found some issues when using double quotes (strings arrays) instead of single quotes (char vectors). Unlike Python in Matlab they are not always interchangeable.

In this recent commit (6677880), Brainstorm (15-Jul-2025) handles the use of strings arrays "text" in the options for processes when calling bst_process('CallProcess', ...' as in your example.

Moreover, a note has been added in the Scripting tutorial to point towards the use of char vectors (single quote):
https://neuroimage.usc.edu/brainstorm/Tutorials/Scripting

2 Likes