Nset node not found

Probably something verry stupid I have overlooked , but I get the "failure in server nset node not found " when executing play , altough it does play correctly
Strange because I have done this a hundreds times


(
SynthDef(\hat,
	{
		|att=0.001,dec=1,amp=0.2,gate=1,out|
		var sig,env;
		sig=WhiteNoise.ar*amp;
		env=EnvGen.ar(Env.perc(att,dec),gate:gate,doneAction:2);
		sig=sig*env!2;
		Out.ar(out,sig)
}).add
)

q=Synth(\hat,[\dec,0.015])
q.free

(
Pdef(\riet,
	Pbind(
		\instrument,
		\hat,
		\dur,0.25,
		\att,0,
		\dec,0.02,
		\amp,0.2,
		\out,0,
	)
)
)

;
Pdef(\riet).play
Pdef(\riet).stop


It has something to do with the gate , I know perfectly what a gate is but somehow I can’t wrap my head around it in supercollider and the pdef’s
Are we supposed to use Pseq for gate Pseq([1,0,1,0,1,0})…etc?
Here I am not using perc envelope but level time , when gate is an argument(set to ) the error remains
Removing gate as argument , error goess away

(
Pdef(\riet,
	Pbind(
		\instrument,
		\hat_2,
		\dur,0.5,
		\att,0,
		\dec,0.1,
		\amp,0.2,
		\out,0,
	)
)
)

;
Pdef(\riet).stop;
Pdef(\riet).play;



(
SynthDef(\hat_2,
	{
		|att=0.001,dec=1,amp=0.2,out,gate=1|
		var sig,env;
		sig=WhiteNoise.ar*amp;
		env=EnvGen.ar(Env([0,1,0],[att,dec],[0,-5]),gate:gate,doneAction:2);
		sig=sig*env!2;
		Out.ar(out,sig)
}).add
)
(
Pdef(\riet,
	Pbind(
		\instrument,
		\hat_2,
		\dur,0.5,
		\att,0,
		\dec,0.1,
		\amp,0.2,
		\out,0,
	)
)
)

;
Pdef(\riet).stop;
Pdef(\riet).play;



(
SynthDef(\hat_2,
	{
		|att=0.001,dec=1,amp=0.2,out|
		var sig,env;
		sig=WhiteNoise.ar*amp;
		env=EnvGen.ar(Env([0,1,0],[att,dec],[0,-5]),doneAction:2);
		sig=sig*env!2;
		Out.ar(out,sig)
}).add
)

Env.perc does not have a gate argument and releases itself after decaying has finished since your done action is 2. Then right after it has been released the Pbind is trying to send a gate argument to a synth which is no longer there. So no gate argument needed here.