{"record":{"id":"1487167b40ac3a64","repo":"FlowiseAI/Flowise","slug":"execution-logs-stderr-join-n","errorCode":null,"errorMessage":"${execution.logs.stderr.join('\\n')}","messagePattern":"\\$\\{execution\\.logs\\.stderr\\.join\\('\\\\n'\\)\\}","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/components/src/utils.ts","lineNumber":1716,"sourceCode":"                `module.exports = async function() {`,\n                ...variableDeclarations,\n                ...otherLines,\n                `}()`\n            ].join('\\n')\n\n            const execution = await sbx.runCode(codeWithImports, { language: 'js' })\n\n            let output = ''\n\n            if (execution.text) output = execution.text\n            if (!execution.text && execution.logs.stdout.length) output = execution.logs.stdout.join('\\n')\n\n            if (execution.error) {\n                throw new Error(`${execution.error.name}: ${execution.error.value}`)\n            }\n\n            if (execution.logs.stderr.length) {\n                throw new Error(execution.logs.stderr.join('\\n'))\n            }\n\n            // Stream output if streaming function provided\n            if (streamOutput && output) {\n                streamOutput(output)\n            }\n\n            // Clean up sandbox\n            sbx.kill()\n\n            return parseOutput(output)\n        } catch (e) {\n            throw new Error(`Sandbox Execution Error: ${e}`)\n        }\n    } else {\n        const builtinDeps = process.env.TOOL_FUNCTION_BUILTIN_DEP\n            ? defaultAllowBuiltInDep.concat(process.env.TOOL_FUNCTION_BUILTIN_DEP.split(','))\n            : defaultAllowBuiltInDep","sourceCodeStart":1698,"sourceCodeEnd":1734,"githubUrl":"https://github.com/FlowiseAI/Flowise/blob/abe4a8601a058047b350c260676826e21dd14101/packages/components/src/utils.ts#L1698-L1734","documentation":"Thrown by the Daytona sandbox branch when execution.error is empty but execution.logs.stderr has content. The sandboxed code ran but wrote to stderr — Flowise treats any stderr output as a hard failure rather than a warning.","triggerScenarios":"User code uses console.error(...) for non-fatal logging; a dependency prints a deprecation warning to stderr (e.g. node:deprecation); an unhandled promise rejection warning lands on stderr; a library emits a stderr diagnostic that isn't actually fatal.","commonSituations":"Custom tool that uses console.error for soft validation messages; older libraries that warn about deprecated APIs to stderr; Node's ExperimentalWarning printed for features the sandboxed code uses; mixing debug logging that goes to stderr.","solutions":["Inspect the stderr lines in the message to see if they are fatal errors or merely warnings.","Replace console.error with console.warn or structured logging if the messages are non-fatal diagnostics.","If a dependency emits stderr warnings, suppress by setting NODE_NO_WARNINGS=1 or upgrading the dependency.","Reconsider treating all stderr as fatal if your tooling legitimately logs diagnostics to stderr."],"exampleFix":"// before — any stderr fails the run\nif (execution.logs.stderr.length) {\n  throw new Error(execution.logs.stderr.join('\\n'))\n}\n\n// after — only fail on error-level stderr patterns; downgrade warnings\nif (execution.logs.stderr.length) {\n  const fatal = execution.logs.stderr.filter((l) => /Error|Exception|throw/i.test(l))\n  if (fatal.length) throw new Error(fatal.join('\\n'))\n  console.warn('Sandbox stderr (non-fatal):', execution.logs.stderr.join('\\n'))\n}","handlingStrategy":"validation","validationCode":"function classifyStderr(lines: string[]): 'fatal' | 'warning' {\n  return lines.some((l) => /Error|Exception|throw|SyntaxError|ReferenceError|TypeError/i.test(l)) ? 'fatal' : 'warning'\n}","typeGuard":"function isFatalStderr(line: string): boolean {\n  return /\\b(Error|Exception|throw|ReferenceError|TypeError|SyntaxError)\\b/i.test(line)\n}","tryCatchPattern":"if (execution.logs.stderr.length) {\n  const fatal = execution.logs.stderr.filter(isFatalStderr)\n  if (fatal.length) throw new Error(fatal.join('\\n'))\n  console.warn('Sandbox stderr (non-fatal):', execution.logs.stderr.join('\\n'))\n}","preventionTips":["Discourage console.error for non-fatal logging in custom tools — use console.warn instead.","Suppress Node ExperimentalWarning via NODE_NO_WARNINGS=1 when warnings are noise.","Document for tool authors that stderr output is treated as failure."],"tags":["sandbox","javascript-execution","stderr","custom-tool"],"backgroundTag":null,"analyzedSha":"abe4a8601a058047b350c260676826e21dd14101","analyzedAt":"2026-08-12T16:04:40.823Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}