Problem integrating Java and Markdown files in n8n workflow to build a RAG agent using Extract from File and Default Data Loader nodes

Title:

“Referenced node is unexecuted” error in Default Data Loader — How to fix?

Message:

Hello everyone,

I’m building an n8n workflow to automatically ingest files (PDF, TXT, DOCX, Java, MD) from a local folder, extract their content using the Extract from File node, then load the data into the Default Data Loader node for indexing.

The problem I’m facing: when I run the workflow, the Default Data Loader node shows this error:

Referenced node is unexecuted

with the message:

“An expression references the node ‘Extract from File’, but it hasn’t been executed yet. Either change the expression, or re-wire your workflow to make sure that node executes first.”

What I’ve done:

The Read Files node correctly reads Java and MD files from my local folder.

The Extract from File node is configured to extract text with Keep Source = Both (JSON and Binary).

In the Default Data Loader, I use an expression like {{ $(‘Extract from File’).item.json.data }} to load the extracted data.

I’ve checked that all nodes are connected in order, but the error persists, especially when I test or run only the Default Data Loader node.

My questions:

How can I make sure the Extract from File node executes before the Default Data Loader node?

Is there a better way to write the expression to get the extracted data?

Any advice on structuring the workflow to avoid this error?

Thank you very much for your help!

Hey @Aziza_Neffati hope all is well. Welcome to the community.

execute it :slight_smile:

Could you share your workflow please, so we can take a look at why the extraction node is not executed before the data loader?

It used to work very well when I uploaded PDF files, and the agent also provided the source of its answers from the uploaded documents.

From what I see you Default Data Loader mentions “Extract from File” node, which may or may not be in the flow, depending on which output of the Switch node the execution takes. When the execution comes out of “1” or “2” - the “Extract from File” node will not be activated and thus the Default Data Loader will error out and complain about the node which is references but wasn’t executed.

The best way to avoid this is to set a variable after both extract nodes and reference that instead, you just need a node that will ALWAYS be in the path of the execution.

In the Switch node, I had three options: Java, Markdown, and PDF. The Java and Markdown branches were directed to the ‘Extract from File’ node with text extraction, since there’s no specific node to extract content directly from Java files.

I directed the extract nodes to convert the content into JSON format

Ok the problem is still the same, - whenever the execution is taking the path through a different extract node - such execution will fail.

this is the error message in the default data loader node Referenced node is unexecuted

An expression references the node ‘Extract from File’, but it hasn’t been executed yet. Either change the expression, or re-wire your workflow to make sure that node executes first.

Right, this error message explains well what the problem is

Do you think I should delete the ‘Convert to JSON’ node and replace it with another one? If so, which node would you recommend? Also, just to clarify — this workflow was working perfectly before I started adding the Java files

Of course it was working, if there are only PDFs - the execution will go through the top Extract node and then the Default Data Loader will always have the right reference to the Extract node.

I already mentioned what I think -

i added merge

I think I just realized the problem in the Default Data Loader node, I was referencing ‘Extract from File’ but it actually has a different name

I’m currently doing an internship, and your support means a lot to me. Thank you very much!

Almost, It is sometimes a different name - if the file is JSON - the name is “Extract from File”, if the file is md or java - the name is “Extract from File1”. This is why you cannot read from “Extract from File” in Default Data Loader when the file is md or java.

you are very welcome. if any answer was helpful, kindly mark it as solution. Thanks.

Cheers.

1 Like

I’ll make sure to mark your answer as the solution. Thanks again!

1 Like