Dynamic Credential Field (Database Name) from Previous Node Expression: "No path back to node" Error

Describe the problem/error/question

I want to dynamically change the database name field inside a credential, based on a value selected in a previous node , since multiple databases exist on the same server and I need to switch between them at runtime.
When I try to use an expression in the credential’s database name field (referencing data from a previous node),
I get this error:ERROR: No path back to node
Is there any supported workaround to switch database names dynamically per execution?

Edit: I’ll try to be clearer.

It’s my MSSQL credential setup. Through a dropdown, I am selecting the DB name, and then some query nodes are executed further (in that DB).

What I am trying to do: since there is an option to take the DB name through an expression, I tried:

  • $(‘NodeName’).item.json (error: No path back to node)

  • {{ $(‘NodeName’).first().json.databaseName }}

The second one didn’t throw an error — it got saved and executed, but returned no output.

So I’m not sure what I’m missing in passing the selected DB name dynamically.


Hi @Adarsh_Kumar Welcome!
for persistent usage i would recommend using the HTTP node with custom auth, as you are dynamically switching credentials which might not be fully supported so you gotta test things, first go with the HTTP node, and also try some expression and see the executions that does it give a error:
{{ $('NodeName').first().json.databaseName }} → Just make sure that node is connected to that node via some way.

There can be a different way also like creating a separate credentials per database but that would be too much work but it might help at certain things using a switch to route the databases between flows dynamically.