{"record":{"id":"c35ae9ac2c40e063","repo":"projectdiscovery/nuclei","slug":"nuclei-js-runtime-program-failed-to-terminate-aft","errorCode":null,"errorMessage":"nuclei js runtime: program failed to terminate after interrupt","messagePattern":"nuclei js runtime: program failed to terminate after interrupt","errorType":"exception","errorClass":"errRuntimeTerminationTimeout","httpStatus":null,"severity":"error","filePath":"pkg/js/compiler/pool.go","lineNumber":69,"sourceCode":"\t\"github.com/projectdiscovery/nuclei/v3/pkg/protocols/common/protocolstate\"\n\t\"github.com/projectdiscovery/nuclei/v3/pkg/utils/json\"\n)\n\nconst (\n\texportToken   = \"Export\"\n\texportAsToken = \"ExportAs\"\n)\n\n// errRuntimeTerminationTimeout is returned by session when the\n// goroutine running goja.Runtime.RunProgram fails to terminate within the\n// grace period after an interrupt was raised. When this error is returned\n// the runtime MUST NOT be touched (no cleanup, no reuse, no Put back to\n// the pool) because the orphaned goroutine is still operating on it; any\n// concurrent access would race with goja's per-runtime state and can\n// trigger a fatal \"concurrent map read and map write\" runtime panic.\n//\n// See https://github.com/projectdiscovery/nuclei/issues/7376.\nvar errRuntimeTerminationTimeout = errors.New(\"nuclei js runtime: program failed to terminate after interrupt\")\n\nvar (\n\tlazyRegistryInit = sync.OnceFunc(func() {\n\t\t// autoregister console node module with default printer it uses gologger backend\n\t\trequire.RegisterNativeModule(console.ModuleName, console.RequireWithPrinter(goconsole.NewGoConsolePrinter()))\n\t})\n\tpooljsc    *syncutil.AdaptiveWaitGroup\n\tlazySgInit = sync.OnceFunc(func() {\n\t\tpooljsc, _ = syncutil.New(syncutil.WithSize(PoolingJsVmConcurrency))\n\t})\n\tsgResizeCheck = func(ctx context.Context) {\n\t\t// resize check point\n\t\tif pooljsc.Size != PoolingJsVmConcurrency {\n\t\t\tif err := pooljsc.Resize(ctx, PoolingJsVmConcurrency); err != nil {\n\t\t\t\tgologger.Warning().Msgf(\"Could not resize workpool: %s\\n\", err)\n\t\t\t}\n\t\t}\n\t}","sourceCodeStart":51,"sourceCodeEnd":87,"githubUrl":"https://github.com/projectdiscovery/nuclei/blob/265b3a3dec374741614e342f813c10f8b38d2bb7/pkg/js/compiler/pool.go#L51-L87","documentation":"Error \"nuclei js runtime: program failed to terminate after interrupt\" thrown in projectdiscovery/nuclei.","triggerScenarios":"Thrown at pkg/js/compiler/pool.go:69 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"265b3a3dec374741614e342f813c10f8b38d2bb7","analyzedAt":"2026-08-15T20:05:51.855Z","schemaVersion":2},"datasetVersion":"2026-08-16T03:17:38.424Z"}